Spaces:
Runtime error
Runtime error
Updated css + design
Browse files- app.py +50 -21
- dicta-logo.jpg +0 -0
app.py
CHANGED
@@ -43,30 +43,59 @@ def model_chat(query: Optional[str], history: Optional[History]) -> Generator[Tu
|
|
43 |
top_p=0.9,
|
44 |
stream=True
|
45 |
)
|
46 |
-
|
47 |
for completion in gen:
|
48 |
-
print(completion)
|
49 |
text = completion.choices[0].delta.content
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
chatbot = gr.Chatbot(label='dicta-il/dictalm2.0-instruct', rtl=True)
|
59 |
-
textbox = gr.Textbox(placeholder="ืืื ืก ืฉืืื ืืขืืจืืช (ืื ืืื ืืืืช!)", label='Input', rtl=True)
|
60 |
-
|
61 |
-
with gr.Row():
|
62 |
-
clear_history = gr.Button("๐งน Clear history")
|
63 |
-
sumbit = gr.Button("๐ Send")
|
64 |
|
65 |
-
sumbit.click(model_chat,
|
66 |
-
inputs=[textbox, chatbot],
|
67 |
-
outputs=[textbox, chatbot])
|
68 |
-
clear_history.click(fn=clear_session,
|
69 |
-
inputs=[],
|
70 |
-
outputs=[textbox, chatbot])
|
71 |
|
72 |
-
demo.queue(api_open=False).launch(max_threads=10,height=800, share=False)
|
|
|
43 |
top_p=0.9,
|
44 |
stream=True
|
45 |
)
|
46 |
+
full_response = ''
|
47 |
for completion in gen:
|
|
|
48 |
text = completion.choices[0].delta.content
|
49 |
+
full_response += text or ''
|
50 |
+
yield full_response
|
51 |
+
|
52 |
+
with gr.Blocks(css='''
|
53 |
+
.gr-group {direction: rtl;}
|
54 |
+
.chatbot{text-align:right;}
|
55 |
+
.dicta-header {
|
56 |
+
background-color: #f4f4f4; /* Replace with desired background color */
|
57 |
+
border-radius: 10px;
|
58 |
+
padding: 20px;
|
59 |
+
text-align: center;
|
60 |
+
display: flex;
|
61 |
+
flex-direction: row;
|
62 |
+
align-items: center;
|
63 |
+
}
|
64 |
+
|
65 |
+
.dicta-logo {
|
66 |
+
width: 150px; /* Replace with actual logo width as desired */
|
67 |
+
height: auto;
|
68 |
+
margin-bottom: 20px;
|
69 |
+
}
|
70 |
+
|
71 |
+
.dicta-intro-text {
|
72 |
+
color: #333; /* Replace with desired text color */
|
73 |
+
margin-bottom: 20px;
|
74 |
+
text-align: center;
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
align-items: center;
|
78 |
+
width: 100%;
|
79 |
+
}
|
80 |
+
''') as demo:
|
81 |
+
gr.Markdown("""
|
82 |
+
<div class="dicta-header">
|
83 |
+
<img src="file/dicta-logo.jpg" alt="Dicta Logo" class="dicta-logo" style="max-height: 75px">
|
84 |
+
<div class="dicta-intro-text">
|
85 |
+
<h1>DictaLM 2.0 - Instruct Chat Demo</h1>
|
86 |
+
<p>Welcome to the interactive demo of DictaLM-2.0. Explore the capabilities of our model and see how it can assist with your tasks.</p>
|
87 |
+
<p dir='rtl'> ืืจืืืื ืืืืื ืืืื ืืืื ืืจืืงืืืื ืฉื DictaLM-2.0. ืืงืจื ืืช ืืืืืืช ืืืืื ืฉืื ื ืืจืื ืืืฆื ืืื ืืืื ืืกืืืข ืืื ืืืฉืืืืชืืื.</p>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
""")
|
91 |
|
92 |
+
interface = gr.ChatInterface(model_chat)
|
93 |
+
interface.chatbot.rtl = True
|
94 |
+
interface.textbox.placeholder = "ืืื ืก ืฉืืื ืืขืืจืืช (ืื ืืื ืืืืช!)"
|
95 |
+
interface.textbox.rtl = True
|
96 |
+
interface.textbox.text_align = 'right'
|
97 |
+
interface.theme_css += '.gr-group {direction: rtl !important;}'
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
+
demo.queue(api_open=False).launch(max_threads=10,height=800, share=False, allowed_paths=['dicta-logo.jpg'], server_port=7861)
|
dicta-logo.jpg
ADDED