deep-learning-analytics commited on
Commit
8817b20
1 Parent(s): bf14948

Update app.py

Browse files

changed from gradio to streamlit

Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -1,6 +1,15 @@
1
  import torch
2
 
3
- import gradio as gr
 
 
 
 
 
 
 
 
 
4
 
5
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
6
 
@@ -31,5 +40,9 @@ def generate_answers(text):
31
  answer = tokenizer.decode(results[0], skip_special_tokens=True)
32
  return answer
33
 
34
- iface = gr.Interface(fn=generate_answers,inputs=[gr.inputs.Textbox(lines=20)], outputs=["text"])
35
- iface.launch(inline=False, share=True)
 
 
 
 
 
1
  import torch
2
 
3
+ import streamlit as st
4
+
5
+ st.title("Title Generation with Transformers")
6
+ st.write("")
7
+ st.write("Input your text here!")
8
+
9
+
10
+ default_value = "Ukrainian counterattacks: Kharkiv's regional administrator said a number of villages around Malaya Rogan were retaken by Ukrainian forces. Video verified by CNN shows Ukrainian troops in control of Vilkhivka, one of the settlements roughly 20 miles from the Russian border. The success of Ukrainian forces around Kharkiv has been mirrored further north, near the city of Sumy, where Ukrainian troops have liberated a number of settlements, according to videos geolocated and verified by CNN. A separate counterattack in the south also led to the liberation of two villages from Russian forces northwest of Mariupol, according to the Zaporizhzhia regional military administration."
11
+
12
+ sent = st.text_area("Text", default_value, height = 50)
13
 
14
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
15
 
 
40
  answer = tokenizer.decode(results[0], skip_special_tokens=True)
41
  return answer
42
 
43
+ answer = generate_answers(sent)
44
+
45
+ st.write(answer)
46
+
47
+ #iface = gr.Interface(fn=generate_answers,inputs=[gr.inputs.Textbox(lines=20)], outputs=["text"])
48
+ #iface.launch(inline=False, share=True)