Lin0He commited on
Commit
9d7a1a6
·
1 Parent(s): 1b41a86

Upload interface.py

Browse files
Files changed (1) hide show
  1. interface.py +11 -24
interface.py CHANGED
@@ -1,26 +1,13 @@
1
- import random
2
  import gradio as gr
3
 
4
-
5
- def chat(message, history):
6
- history = history or []
7
- if message.startswith("How many"):
8
- response = random.randint(1, 10)
9
- elif message.startswith("How"):
10
- response = random.choice(["Great", "Good", "Okay", "Bad"])
11
- elif message.startswith("Where"):
12
- response = random.choice(["Here", "There", "Somewhere"])
13
- else:
14
- response = "I don't know"
15
- history.append((message, response))
16
- return history, history
17
-
18
-
19
- iface = gr.Interface(
20
- chat,
21
- ["text", "state"],
22
- ["chatbot", "state"],
23
- allow_screenshot=False,
24
- allow_flagging="never",
25
- )
26
- iface.launch()
 
 
1
  import gradio as gr
2
 
3
+ title = "GPT-J-6B"
4
+ description = "Gradio Demo for GPT-J 6B, a transformer model trained using Ben Wang's Mesh Transformer JAX. 'GPT-J' refers to the class of model, while '6B' represents the number of trainable parameters. To use it, simply add your text, or click one of the examples to load them. Read more at the links below."
5
+ article = "<p style='text-align: center'><a href='https://github.com/kingoflolz/mesh-transformer-jax' target='_blank'>GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model</a></p>"
6
+
7
+ gr.Interface.load(
8
+ "huggingface/EleutherAI/gpt-j-6B",
9
+ inputs=gr.Textbox(lines=5, label="Input Text"),
10
+ title=title,
11
+ description=description,
12
+ article=article,
13
+ ).launch()