ThomasSimonini HF staff commited on
Commit
e14c3a3
1 Parent(s): ee3184e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio.inputs import Textbox, Slider
3
+
4
+ # Template
5
+ title = "A conversation with some NPC in a Tavern 🍻"
6
+ description = ""
7
+ article = """
8
+ <p> If you liked don't forget to 💖 the project 🥰 </p>
9
+ <h2> Parameters: </h2>
10
+ <ul>
11
+ <li><i>npc_prompt</i>: prompt of the NPC, we can modify it to see if results are better.</li>
12
+ <li><i>top_p</i>: control how deterministic the model is in generating a response.</li>
13
+ <li><i>temperature</i>: (sampling temperature) higher values means the model will take more risks.</li>
14
+ <li><i>max_new_tokens</i>: Max number of tokens in generation.</li>
15
+ </ul>
16
+ <img src='http://www.simoninithomas.com/test/gandalf.jpg', alt="Gandalf"/>"""
17
+ theme="huggingface"
18
+
19
+
20
+
21
+
22
+
23
+ #examples = [[0.9, 1.1, 50, "Hey Gandalf! How are you?"], [0.9, 1.1, 50, "Hey Gandalf, why you didn't use the great eagles to fly Frodo to Mordor?"]]
24
+
25
+
26
+
27
+
28
+ def generate_text():
29
+ pass
30
+
31
+
32
+
33
+
34
+ io = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
35
+
36
+ iface = gr.Interface(fn=generate_text,
37
+ inputs=[Textbox(label="Prompt"),
38
+ Slider(minimum=0.5, maximum=1, step=0.05, default=0.9, label="top_p"),
39
+ Slider(minimum=0.5, maximum=1.5, step=0.1, default=1.1, label="temperature"),
40
+ Slider(minimum=20, maximum=250, step=10, default=50, label="max_new_tokens")],
41
+ outputs="text",
42
+ examples="",
43
+ allow_screenshot=True,
44
+ allow_flagging=True,
45
+ title=title,
46
+ article=article,
47
+ theme=theme)
48
+
49
+ if __name__ == "__main__":
50
+ iface.launch()