Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,17 @@ def generate_analysis(trending_topic):
|
|
56 |
|
57 |
# Tokenize and generate text with a max limit on tokens
|
58 |
inputs = tokenizer(input_text, return_tensors="pt").to(device)
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
analysis = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
62 |
|
@@ -140,4 +150,4 @@ def gradio_interface():
|
|
140 |
|
141 |
# Launch the Gradio UI
|
142 |
if __name__ == "__main__":
|
143 |
-
gradio_interface().launch(
|
|
|
56 |
|
57 |
# Tokenize and generate text with a max limit on tokens
|
58 |
inputs = tokenizer(input_text, return_tensors="pt").to(device)
|
59 |
+
|
60 |
+
# Create a generation configuration
|
61 |
+
generation_config = {
|
62 |
+
"max_length": 80,
|
63 |
+
"num_return_sequences": 1,
|
64 |
+
"do_sample": True,
|
65 |
+
"top_k": 50,
|
66 |
+
"top_p": 0.95,
|
67 |
+
}
|
68 |
+
|
69 |
+
outputs = model.generate(**inputs, **generation_config)
|
70 |
|
71 |
analysis = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
72 |
|
|
|
150 |
|
151 |
# Launch the Gradio UI
|
152 |
if __name__ == "__main__":
|
153 |
+
gradio_interface().launch() # Removed share=True since it is not supported
|