Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,9 +33,37 @@ theme = gr.themes.Base(
|
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
+
header = """<center><b><p style=\"color: #E13C32; font-size: 36px;\">My Ardian Chatbot</p></b></center>
|
| 37 |
+
<i><p style=\"font-size: 16px; color: grey;\">Please make sure to formulate clear and precise questions and to add contextual information when possible. This will help the tool produce the most relevant response. Adopt an iterative approach and ask for more details or explanations when necessary.</br><i/></p>"""
|
| 38 |
+
|
| 39 |
+
footnote = "<p style=\"font-size: 16px; color: grey;\"> ⚠ The chatbot doesn't have a memory, it doesn't remember what it previously generated.</a></p>"
|
| 40 |
+
|
| 41 |
+
theme = gr.themes.Base(
|
| 42 |
+
primary_hue="red",
|
| 43 |
+
secondary_hue="gray",
|
| 44 |
+
font=['FuturaTOT', '=', '36px']
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
def ask_ai(doc,message):
|
| 48 |
+
return message
|
| 49 |
+
|
| 50 |
+
with gr.Blocks(theme=theme) as demo:
|
| 51 |
+
gr.Markdown(header)
|
| 52 |
+
|
| 53 |
+
download_button = gr.inputs.File(label="Upload a PDF")
|
| 54 |
+
chatbot = gr.Chatbot()
|
| 55 |
+
question = gr.Textbox(label='Question', info="Please write your question here.")
|
| 56 |
+
clear = gr.Button("Clear")
|
| 57 |
+
|
| 58 |
+
def respond(message, chat_history, doc):
|
| 59 |
+
bot_message = ask_ai(doc, message)
|
| 60 |
+
chat_history.append((message, bot_message))
|
| 61 |
+
time.sleep(2)
|
| 62 |
+
return "", chat_history
|
| 63 |
|
| 64 |
+
question.submit(respond, [question, chatbot, download_button], [question, chatbot])
|
| 65 |
+
|
| 66 |
+
clear.click(lambda: None, None, chatbot, queue=False)
|
| 67 |
+
gr.Markdown(footnote)
|
| 68 |
|
| 69 |
+
demo.launch(share=True, auth=("username", "password"), debug=True)
|