kidsampson commited on
Commit
0019f15
·
verified ·
1 Parent(s): e44a4b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -1,28 +1,10 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
-
4
- pipe = pipeline("text-generation", model="openai-community/gpt2")
5
-
6
- def response(messages):
7
- return pipe(messages)
8
-
9
- demo = gr.Interface(
10
- response,
11
- inputs=[gr.Textbox(label="Input your question: ", lines=3)],
12
- outputs=[gr.Textbox(label="Here's the answer: ", lines=3)],
13
- title="Ask me anything!",
14
- )
15
-
16
- demo.launch()
17
-
18
  # import gradio as gr
19
  # from transformers import pipeline
20
 
21
- # pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-3B-Instruct")
22
 
23
  # def response(messages):
24
- # message = ['{"role": "user", "content": '+messages+'},']
25
- # return pipe(message)
26
 
27
  # demo = gr.Interface(
28
  # response,
@@ -33,6 +15,24 @@ demo.launch()
33
 
34
  # demo.launch()
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  # import gradio as gr
37
  # from transformers import pipeline
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # import gradio as gr
2
  # from transformers import pipeline
3
 
4
+ # pipe = pipeline("text-generation", model="openai-community/gpt2")
5
 
6
  # def response(messages):
7
+ # return pipe(messages)
 
8
 
9
  # demo = gr.Interface(
10
  # response,
 
15
 
16
  # demo.launch()
17
 
18
+ import gradio as gr
19
+ from transformers import pipeline
20
+
21
+ pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-3B-Instruct")
22
+
23
+ def response(messages):
24
+ message = ['{"role": "user", "content": '+messages+'},']
25
+ return pipe(message)
26
+
27
+ demo = gr.Interface(
28
+ response,
29
+ inputs=[gr.Textbox(label="Input your question: ", lines=3)],
30
+ outputs=[gr.Textbox(label="Here's the answer: ", lines=3)],
31
+ title="Ask me anything!",
32
+ )
33
+
34
+ demo.launch()
35
+
36
  # import gradio as gr
37
  # from transformers import pipeline
38