Spaces:
Runtime error
Runtime error
mahrukhsaeed2702 commited on
Commit Β·
49abb51
1
Parent(s): 9aa21ec
change
Browse files- app.py +4 -6
- requirements.txt +1 -3
app.py
CHANGED
|
@@ -1,15 +1,13 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
| 5 |
-
model = pipeline(
|
| 6 |
-
"summarization", framework="pt")
|
| 7 |
|
| 8 |
def predict(prompt):
|
| 9 |
summary = model(prompt)[0]["summary_text"]
|
| 10 |
return summary
|
| 11 |
|
| 12 |
-
|
| 13 |
-
# create an interface for the model
|
| 14 |
with gr.Interface(predict, "textbox", "text") as interface:
|
| 15 |
-
interface.launch()
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
# Force framework to PyTorch (no TF/Keras dependency)
|
| 5 |
+
model = pipeline("summarization", model="google-t5/t5-small", framework="pt")
|
|
|
|
| 6 |
|
| 7 |
def predict(prompt):
|
| 8 |
summary = model(prompt)[0]["summary_text"]
|
| 9 |
return summary
|
| 10 |
|
| 11 |
+
# Gradio interface
|
|
|
|
| 12 |
with gr.Interface(predict, "textbox", "text") as interface:
|
| 13 |
+
interface.launch()
|
requirements.txt
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
gradio
|
| 2 |
transformers
|
| 3 |
-
|
| 4 |
-
transformers
|
| 5 |
-
tf-keras
|
|
|
|
| 1 |
gradio
|
| 2 |
transformers
|
| 3 |
+
torch
|
|
|
|
|
|