Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ question_answering = pipeline("question-answering", model="deepset/roberta-base-
|
|
| 16 |
code_generation = pipeline("text-generation", model="Salesforce/codegen-350M-mono", device=device)
|
| 17 |
summarization = pipeline("summarization", model="facebook/bart-large-cnn", device=device)
|
| 18 |
#translation = pipeline("translation_en_to_fr", model="Helsinki-NLP/opus-mt-en-fr", device=device)
|
| 19 |
-
translation = pipeline("translation", model="facebook/m2m100_418M", device=device)
|
| 20 |
text_generation = pipeline("text-generation", model="gpt2", device=device)
|
| 21 |
text_classification = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english", device=device)
|
| 22 |
|
|
@@ -36,10 +36,7 @@ def summarize_text(text):
|
|
| 36 |
output = summarization(text, max_length=100, min_length=30, do_sample=False)
|
| 37 |
return output[0]['summary_text']
|
| 38 |
|
| 39 |
-
|
| 40 |
-
def translate_text(text):
|
| 41 |
-
output = translation(text)
|
| 42 |
-
return output[0]['translation_text']
|
| 43 |
|
| 44 |
@spaces.GPU
|
| 45 |
def generate_text(prompt):
|
|
@@ -75,12 +72,6 @@ with gr.Blocks() as demo:
|
|
| 75 |
summary_output = gr.Textbox(label="Summary")
|
| 76 |
summary_btn.click(summarize_text, inputs=summary_input, outputs=summary_output)
|
| 77 |
|
| 78 |
-
with gr.Tab("4️⃣ Translation (EN → FR)"):
|
| 79 |
-
translate_input = gr.Textbox(label="English Text", placeholder="Enter text in English...")
|
| 80 |
-
translate_btn = gr.Button("Translate")
|
| 81 |
-
translate_output = gr.Textbox(label="French Translation")
|
| 82 |
-
translate_btn.click(translate_text, inputs=translate_input, outputs=translate_output)
|
| 83 |
-
|
| 84 |
with gr.Tab("5️⃣ Text Generation"):
|
| 85 |
text_input = gr.Textbox(label="Text Prompt", placeholder="Start your text...")
|
| 86 |
text_btn = gr.Button("Generate Text")
|
|
|
|
| 16 |
code_generation = pipeline("text-generation", model="Salesforce/codegen-350M-mono", device=device)
|
| 17 |
summarization = pipeline("summarization", model="facebook/bart-large-cnn", device=device)
|
| 18 |
#translation = pipeline("translation_en_to_fr", model="Helsinki-NLP/opus-mt-en-fr", device=device)
|
| 19 |
+
#translation = pipeline("translation", model="facebook/m2m100_418M", device=device)
|
| 20 |
text_generation = pipeline("text-generation", model="gpt2", device=device)
|
| 21 |
text_classification = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english", device=device)
|
| 22 |
|
|
|
|
| 36 |
output = summarization(text, max_length=100, min_length=30, do_sample=False)
|
| 37 |
return output[0]['summary_text']
|
| 38 |
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
@spaces.GPU
|
| 42 |
def generate_text(prompt):
|
|
|
|
| 72 |
summary_output = gr.Textbox(label="Summary")
|
| 73 |
summary_btn.click(summarize_text, inputs=summary_input, outputs=summary_output)
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
with gr.Tab("5️⃣ Text Generation"):
|
| 76 |
text_input = gr.Textbox(label="Text Prompt", placeholder="Start your text...")
|
| 77 |
text_btn = gr.Button("Generate Text")
|