chandrujobs commited on
Commit
2f388dc
·
verified ·
1 Parent(s): d8778e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
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
- outputs = model.generate(**inputs, max_length=80, num_return_sequences=1, do_sample=True, top_k=50, top_p=0.95)
 
 
 
 
 
 
 
 
 
 
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(share=True) # Set share=True for public link
 
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