shing12345 commited on
Commit
4679eb2
1 Parent(s): 483a471

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -32
app.py CHANGED
@@ -1,35 +1,7 @@
1
  import gradio as gr
2
- from model import AdvancedSummarizer, AdvancedTextGenerator
3
 
4
- # Initialize the model classes
5
- summarizer = AdvancedSummarizer()
6
- generator = AdvancedTextGenerator()
7
 
8
- # Function for summarization
9
- def summarize_text(text):
10
- return summarizer.summarize(text)
11
-
12
- # Function for text generation
13
- def generate_text(prompt):
14
- return generator.generate_text(prompt)[0] # Return the first generated sequence
15
-
16
- # Create Gradio interfaces
17
- summarizer_interface = gr.Interface(
18
- fn=summarize_text,
19
- inputs=gr.inputs.Textbox(lines=5, label="Input Text for Summarization"),
20
- outputs=gr.outputs.Textbox(label="Summary"),
21
- title="Text Summarizer",
22
- description="Enter text to get a summary."
23
- )
24
-
25
- generator_interface = gr.Interface(
26
- fn=generate_text,
27
- inputs=gr.inputs.Textbox(lines=5, label="Input Prompt for Text Generation"),
28
- outputs=gr.outputs.Textbox(label="Generated Text"),
29
- title="Text Generator",
30
- description="Enter a prompt to generate text."
31
- )
32
-
33
- # Combine both interfaces in a tabbed layout
34
- app = gr.TabbedInterface([summarizer_interface, generator_interface], ["Summarizer", "Text Generator"])
35
- app.launch()
 
1
  import gradio as gr
 
2
 
3
+ def greet(name):
4
+ return "Hello " + name + "!!"
 
5
 
6
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
+ demo.launch()