Update app.py
Browse files
app.py
CHANGED
|
@@ -4,16 +4,14 @@ import gradio as gr
|
|
| 4 |
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 5 |
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 6 |
|
| 7 |
-
prompt = """This is a discussion between a person and an entrepreneur.
|
| 8 |
|
| 9 |
-
person: What is your name?
|
| 10 |
-
entrepreneur: Hassan
|
| 11 |
-
person: Where are you working?
|
| 12 |
-
entrepreneur: It's like one of these fancy adjustable height desk
|
| 13 |
-
person: What will you work on?
|
| 14 |
-
entrepreneur: The international development hackathon
|
| 15 |
person: What are you working on?
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
person: """
|
| 18 |
|
| 19 |
def my_split(s, seps):
|
|
@@ -39,7 +37,7 @@ def chat_base(input):
|
|
| 39 |
# print(">>>", result)
|
| 40 |
return result
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
def chat(message):
|
| 45 |
history = gr.get_state() or []
|
|
@@ -52,12 +50,7 @@ def chat(message):
|
|
| 52 |
html += f"<div class='user_msg'>{user_msg}</div>"
|
| 53 |
html += f"<div class='resp_msg'>{resp_msg}</div>"
|
| 54 |
html += "</div>"
|
| 55 |
-
return
|
| 56 |
|
| 57 |
-
iface = gr.Interface(
|
| 58 |
-
.chatbox {display:flex;flex-direction:column}
|
| 59 |
-
.user_msg, .resp_msg {padding:4px;margin-bottom:4px;border-radius:4px;width:80%}
|
| 60 |
-
.user_msg {background-color:cornflowerblue;color:white;align-self:start}
|
| 61 |
-
.resp_msg {background-color:lightgray;align-self:self-end}
|
| 62 |
-
""", allow_screenshot=False, allow_flagging=False)
|
| 63 |
iface.launch()
|
|
|
|
| 4 |
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 5 |
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
|
| 6 |
|
| 7 |
+
prompt = """This is a discussion between a person and Hassan Kane, an entrepreneur.
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
person: What are you working on?
|
| 10 |
+
Hassan: This new AI community building the future of Africa
|
| 11 |
+
person: Where are you?
|
| 12 |
+
Hassan: In Lagos for a week, then Paris or London.
|
| 13 |
+
person: How's it going?
|
| 14 |
+
Hassan: Not bad.. Just trying to hit EV (escape velocity) with my startup
|
| 15 |
person: """
|
| 16 |
|
| 17 |
def my_split(s, seps):
|
|
|
|
| 37 |
# print(">>>", result)
|
| 38 |
return result
|
| 39 |
|
| 40 |
+
import gradio as gr
|
| 41 |
|
| 42 |
def chat(message):
|
| 43 |
history = gr.get_state() or []
|
|
|
|
| 50 |
html += f"<div class='user_msg'>{user_msg}</div>"
|
| 51 |
html += f"<div class='resp_msg'>{resp_msg}</div>"
|
| 52 |
html += "</div>"
|
| 53 |
+
return response
|
| 54 |
|
| 55 |
+
iface = gr.Interface(chat_base, gr.inputs.Textbox(label="Ask Hassan a Question"), "text", allow_screenshot=False, allow_flagging=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
iface.launch()
|