Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import transformers
|
| 3 |
|
| 4 |
-
# Load a pre-trained model.
|
| 5 |
-
model = transformers.AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large")
|
| 6 |
|
| 7 |
# Define a function to generate text.
|
| 8 |
def generate_text(text):
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
-
input_ids = model.tokenizer.encode(text, return_tensors="pt")
|
| 13 |
-
|
| 14 |
-
# Generate text.
|
| 15 |
-
output_ids = model.generate(input_ids=input_ids, max_length=100, num_beams=5)
|
| 16 |
-
|
| 17 |
-
# Decode the output text.
|
| 18 |
-
output_text = model.tokenizer.decode(output_ids[0])
|
| 19 |
-
|
| 20 |
-
return output_text
|
| 21 |
|
| 22 |
# Define the Gradio interface.
|
| 23 |
chat_box = gr.inputs.Textbox(label="Chat Box")
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Define a function to generate text.
|
| 5 |
def generate_text(text):
|
| 6 |
+
|
| 7 |
|
| 8 |
+
return 'success'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Define the Gradio interface.
|
| 11 |
chat_box = gr.inputs.Textbox(label="Chat Box")
|