Spaces:
Sleeping
Sleeping
syntax error fixed
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# app.py
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
@@ -23,7 +23,7 @@ def summarize(text, language_choice, min_length):
|
|
23 |
if not text or not text.strip():
|
24 |
return "Please enter text to summarize."
|
25 |
|
26 |
-
|
27 |
# Set the prompt based on the language choice
|
28 |
if language_choice == "Turkish Text -> Turkish Summary":
|
29 |
prompt = f"summarize: {text}"
|
@@ -55,7 +55,7 @@ iface = gr.Interface(
|
|
55 |
inputs=[
|
56 |
gr.Textbox(lines=15, placeholder="Paste the text you want to summarize here...", label="Text Input"),
|
57 |
gr.Radio(
|
58 |
-
|
59 |
["Turkish Text -> Turkish Summary", "English Text -> English Summary"],
|
60 |
label="Summarization Type",
|
61 |
value="Turkish Text -> Turkish Summary"
|
@@ -75,7 +75,7 @@ iface = gr.Interface(
|
|
75 |
The model was fine-tuned on 30,000 Turkish-English summary pairs using the LoRA technique,
|
76 |
based on the `google/mt5-small` model.""",
|
77 |
|
78 |
-
|
79 |
examples=[
|
80 |
["Güneş enerjisi kullanımı son yıllarda hızla artıyor. Evler ve iş yerleri çatılarında güneş panelleri kurarak elektrik üretiyor. Bu sayede enerji faturaları düşüyor ve çevreye zarar vermeyen temiz enerji kullanılıyor. Uzmanlar, güneş enerjisinin gelecekte elektrik ihtiyacının büyük kısmını karşılayabileceğini ve fosil yakıtlara olan bağımlılığı azaltacağını söylüyor.", "Turkish Text -> Turkish Summary", 10],
|
81 |
["Electric cars are becoming increasingly popular worldwide. People choose electric vehicles because they produce less pollution and reduce fuel costs. Governments are promoting them by offering incentives and building more charging stations. Experts believe that electric cars could eventually replace most gasoline-powered vehicles, significantly decreasing greenhouse gas emissions and contributing to a cleaner environment.", "English Text -> English Summary", 10]
|
|
|
1 |
+
# app.py
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
23 |
if not text or not text.strip():
|
24 |
return "Please enter text to summarize."
|
25 |
|
26 |
+
|
27 |
# Set the prompt based on the language choice
|
28 |
if language_choice == "Turkish Text -> Turkish Summary":
|
29 |
prompt = f"summarize: {text}"
|
|
|
55 |
inputs=[
|
56 |
gr.Textbox(lines=15, placeholder="Paste the text you want to summarize here...", label="Text Input"),
|
57 |
gr.Radio(
|
58 |
+
|
59 |
["Turkish Text -> Turkish Summary", "English Text -> English Summary"],
|
60 |
label="Summarization Type",
|
61 |
value="Turkish Text -> Turkish Summary"
|
|
|
75 |
The model was fine-tuned on 30,000 Turkish-English summary pairs using the LoRA technique,
|
76 |
based on the `google/mt5-small` model.""",
|
77 |
|
78 |
+
|
79 |
examples=[
|
80 |
["Güneş enerjisi kullanımı son yıllarda hızla artıyor. Evler ve iş yerleri çatılarında güneş panelleri kurarak elektrik üretiyor. Bu sayede enerji faturaları düşüyor ve çevreye zarar vermeyen temiz enerji kullanılıyor. Uzmanlar, güneş enerjisinin gelecekte elektrik ihtiyacının büyük kısmını karşılayabileceğini ve fosil yakıtlara olan bağımlılığı azaltacağını söylüyor.", "Turkish Text -> Turkish Summary", 10],
|
81 |
["Electric cars are becoming increasingly popular worldwide. People choose electric vehicles because they produce less pollution and reduce fuel costs. Governments are promoting them by offering incentives and building more charging stations. Experts believe that electric cars could eventually replace most gasoline-powered vehicles, significantly decreasing greenhouse gas emissions and contributing to a cleaner environment.", "English Text -> English Summary", 10]
|