antoineandrieu commited on
Commit
c8d6d95
·
1 Parent(s): d30ccfe

Remove useless styling & create public link

Browse files
Files changed (1) hide show
  1. app.py +28 -57
app.py CHANGED
@@ -30,39 +30,34 @@ async def respond(message, history, thread_state):
30
  response += token
31
  yield history + [(message, response)], thread_state
32
 
 
 
 
33
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
34
- with gr.Row():
35
- with gr.Column(scale=1):
36
- gr.Markdown("### Historique des conversations")
37
- chat_list = gr.Chatbot(height=700, show_label=False)
38
-
39
- with gr.Column(scale=3):
40
- gr.Markdown("### Assistant R&D Agricole")
41
- chatbot = gr.Chatbot(
42
- height=600,
43
- avatar_images=(
44
- "https://em-content.zobj.net/source/microsoft-teams/363/person_1f9d1.png", # Person emoji
45
- "https://em-content.zobj.net/source/microsoft-teams/363/robot_1f916.png" # Robot emoji
46
- ),
47
- container=True,
48
  show_label=False,
 
 
49
  )
50
- with gr.Row():
51
- txt = gr.Textbox(
52
- placeholder="Posez votre question ici concernant les données R&D agricoles...",
53
- show_label=False,
54
- container=False,
55
- scale=9,
56
- )
57
- submit_btn = gr.Button("Envoyer", scale=1)
58
-
59
- with gr.Row():
60
- clear_btn = gr.Button("Effacer la conversation")
61
-
62
- thread_state = gr.State(value=None)
63
-
64
- def clear_conversation():
65
- return [], None
66
 
67
  txt.submit(
68
  respond,
@@ -70,7 +65,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
70
  [chatbot, thread_state],
71
  api_name=False
72
  ).then(
73
- lambda: "", # Clear the textbox after submission
74
  None,
75
  [txt]
76
  )
@@ -81,7 +76,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
81
  [chatbot, thread_state],
82
  api_name=False
83
  ).then(
84
- lambda: "", # Clear the textbox after submission
85
  None,
86
  [txt]
87
  )
@@ -93,29 +88,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
93
  api_name=False
94
  )
95
 
96
- gr.Markdown("""
97
- <style>
98
- .gradio-container {
99
- background-color: #f5f7f5;
100
- }
101
- .contain {
102
- max-width: 1200px !important;
103
- margin: auto;
104
- }
105
- .message {
106
- padding: 15px;
107
- border-radius: 10px;
108
- margin-bottom: 10px;
109
- }
110
- .user-message {
111
- background-color: #e6f3ff;
112
- }
113
- .bot-message {
114
- background-color: #f5f5f5;
115
- }
116
- footer {display: none !important}
117
- </style>
118
- """)
119
-
120
  if __name__ == "__main__":
121
- demo.launch()
 
30
  response += token
31
  yield history + [(message, response)], thread_state
32
 
33
+ def clear_conversation():
34
+ return [], None
35
+
36
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
37
+ with gr.Column(scale=3):
38
+ gr.Markdown("### Assistant R&D Agricole")
39
+ chatbot = gr.Chatbot(
40
+ height=600,
41
+ avatar_images=(
42
+ "https://em-content.zobj.net/source/microsoft-teams/337/farmer_1f9d1-200d-1f33e.png",
43
+ "https://em-content.zobj.net/source/microsoft-teams/363/robot_1f916.png"
44
+ ),
45
+ container=True,
46
+ show_label=False,
47
+ )
48
+ with gr.Row():
49
+ txt = gr.Textbox(
50
+ placeholder="Posez votre question ici concernant les données R&D agricoles...",
51
  show_label=False,
52
+ container=False,
53
+ scale=9,
54
  )
55
+ submit_btn = gr.Button("Envoyer", scale=1)
56
+
57
+ with gr.Row():
58
+ clear_btn = gr.Button("Effacer la conversation")
59
+
60
+ thread_state = gr.State()
 
 
 
 
 
 
 
 
 
 
61
 
62
  txt.submit(
63
  respond,
 
65
  [chatbot, thread_state],
66
  api_name=False
67
  ).then(
68
+ lambda: "",
69
  None,
70
  [txt]
71
  )
 
76
  [chatbot, thread_state],
77
  api_name=False
78
  ).then(
79
+ lambda: "",
80
  None,
81
  [txt]
82
  )
 
88
  api_name=False
89
  )
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  if __name__ == "__main__":
92
+ demo.launch(share=True)