louisedrumm commited on
Commit
0265015
·
1 Parent(s): ed66db2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ model = pipeline("text-generation")
4
+
5
+
6
+ def predict(prompt):
7
+ completion = model(prompt)[0]["generated_text"]
8
+ return completion
9
+
10
+ # We instantiate the Textbox class
11
+ textbox = gr.Textbox(label="Type your name here:", placeholder="John Doe", lines=2)
12
+
13
+ title = "Ask Louise a Question"
14
+ description = """
15
+ The bot was trained to answer questions based module documentation. Ask Louise anything!
16
+ <img src="https://huggingface.co/spaces/course-demos/Rick_and_Morty_QA/resolve/main/rick.png" width=200px>
17
+ """
18
+ article = "Check out [the original Rick and Morty Bot](https://huggingface.co/spaces/kingabzpro/Rick_and_Morty_Bot) that this demo is based off of."
19
+
20
+ gr.Interface(fn=predict, inputs="textbox", outputs="text",
21
+ title=title,
22
+ description=description,
23
+ article=article,
24
+ examples=[["What are you doing?"], ["Where should we time travel to?"]],
25
+ ).launch()