Spaces:
Runtime error
Runtime error
yirmibesogluz
commited on
Commit
•
6f5fc9c
1
Parent(s):
12f457b
Changed filename
Browse files- app.py +12 -12
- pages/{Summarization.py → 1_Text_Summarization.py} +3 -2
app.py
CHANGED
@@ -19,13 +19,13 @@ st.markdown(
|
|
19 |
unsafe_allow_html=True,
|
20 |
)
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
"""
|
30 |
|
31 |
<h3 style="text-align:right;">TURNA is a Turkish encoder-decoder language model.</h3>
|
@@ -37,14 +37,14 @@ st.markdown(
|
|
37 |
unsafe_allow_html=True,
|
38 |
)
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
def query(payload):
|
50 |
#{"inputs": payload, ""}
|
|
|
19 |
unsafe_allow_html=True,
|
20 |
)
|
21 |
|
22 |
+
st.write("#")
|
23 |
|
24 |
+
col = st.columns(2)
|
25 |
|
26 |
+
col[0].image("images/turna-logo.png", width=100)
|
27 |
|
28 |
+
st.markdown(
|
29 |
"""
|
30 |
|
31 |
<h3 style="text-align:right;">TURNA is a Turkish encoder-decoder language model.</h3>
|
|
|
37 |
unsafe_allow_html=True,
|
38 |
)
|
39 |
|
40 |
+
#st.title('Turkish Language Generation')
|
41 |
+
#st.write('...with Turna')
|
42 |
+
input_text = st.text_area(label='Enter a text: ', height=100,
|
43 |
+
value="Türkiye'nin başkeni neresidir?")
|
44 |
+
if st.button("Generate"):
|
45 |
+
with st.spinner('Generating...'):
|
46 |
+
output = query(input_text)
|
47 |
+
st.success(output)
|
48 |
|
49 |
def query(payload):
|
50 |
#{"inputs": payload, ""}
|
pages/{Summarization.py → 1_Text_Summarization.py}
RENAMED
@@ -2,6 +2,7 @@ import requests
|
|
2 |
import streamlit as st
|
3 |
import time
|
4 |
from transformers import pipeline
|
|
|
5 |
|
6 |
st.set_page_config(page_title="Text Summarization", page_icon="📈")
|
7 |
API_URL = "https://api-inference.huggingface.co/models/boun-tabi-LMG/turna_summarization_mlsum"
|
@@ -22,9 +23,9 @@ if st.button("Generate"):
|
|
22 |
st.success(output)
|
23 |
|
24 |
def query(payload):
|
25 |
-
|
26 |
while True:
|
27 |
-
response = requests.post(API_URL, headers=headers, json=
|
28 |
if 'error' not in response.json():
|
29 |
output = response.json()[0]["generated_text"]
|
30 |
return output
|
|
|
2 |
import streamlit as st
|
3 |
import time
|
4 |
from transformers import pipeline
|
5 |
+
import os
|
6 |
|
7 |
st.set_page_config(page_title="Text Summarization", page_icon="📈")
|
8 |
API_URL = "https://api-inference.huggingface.co/models/boun-tabi-LMG/turna_summarization_mlsum"
|
|
|
23 |
st.success(output)
|
24 |
|
25 |
def query(payload):
|
26 |
+
data = {"inputs": payload, "parameters": {"length_penalty": 2.0, "no_repeat_ngram_size": 3}}
|
27 |
while True:
|
28 |
+
response = requests.post(API_URL, headers=headers, json=data)
|
29 |
if 'error' not in response.json():
|
30 |
output = response.json()[0]["generated_text"]
|
31 |
return output
|