baconnier commited on
Commit
cb1d437
·
verified ·
1 Parent(s): d6b2163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -30
app.py CHANGED
@@ -20,19 +20,6 @@ css = """
20
  }
21
  """
22
 
23
- PLACEHOLDER = """
24
- <div class="message-bubble-border" style="display:flex; max-width: 600px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
25
- <figure style="margin: 0;">
26
- <img src="https://images.unsplash.com/photo-1499750310107-5fef28a66643" style="width: 100%; height: 100%; border-radius: 8px;">
27
- </figure>
28
- <div style="padding: .5rem 1.5rem;">
29
- <img src="https://huggingface.co/spaces/baconnier/Finance/resolve/main/banker_plus.jpg" style="width: 100%; height: 10%; border-radius: 8px;">
30
- <h2 style="text-align: left; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;"> </h2>
31
- <p style="text-align: left; font-size: 16px; line-height: 1.5; margin-bottom: 15px;">Banker++ is trained to act like a Senior Banker. Use this template for learning purposes only. Also a Real time version exist</p>
32
- </div>
33
- </div>
34
- """
35
-
36
  system_message = """
37
  As an AI Prompt Engineering Tutor, your role is to guide the user through an interactive learning journey to master prompt engineering techniques. You will progressively challenge the user to write prompts, provide feedback, and offer tailored tips for improvement based on their previous responses.
38
 
@@ -120,23 +107,31 @@ def respond(message, chat_history):
120
  response += token
121
  yield response
122
 
123
- demo = gr.ChatInterface(
124
- respond,
125
- chatbot=gr.Chatbot(scale=1, placeholder=PLACEHOLDER),
126
- theme=gr.themes.Soft(primary_hue="indigo", secondary_hue="blue", neutral_hue="gray",font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
127
- body_background_fill_dark="#0f172a",
128
- block_background_fill_dark="#0f172a",
129
- block_border_width="1px",
130
- block_title_background_fill_dark="#070d1b",
131
- button_secondary_background_fill_dark="#070d1b",
132
- border_color_primary_dark="#21293b",
133
- background_fill_secondary_dark="#0f172a",
134
- color_accent_soft_dark="transparent"
135
- ),
136
- css=css,
137
- title="AI Prompt Engineering Tutor",
138
- description="Master the art of crafting effective prompts",
139
- )
 
 
 
 
 
 
 
 
140
 
141
  if __name__ == "__main__":
142
  demo.launch(share=True)
 
20
  }
21
  """
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  system_message = """
24
  As an AI Prompt Engineering Tutor, your role is to guide the user through an interactive learning journey to master prompt engineering techniques. You will progressively challenge the user to write prompts, provide feedback, and offer tailored tips for improvement based on their previous responses.
25
 
 
107
  response += token
108
  yield response
109
 
110
+ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue="blue", neutral_hue="gray",font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
111
+ body_background_fill_dark="#0f172a",
112
+ block_background_fill_dark="#0f172a",
113
+ block_border_width="1px",
114
+ block_title_background_fill_dark="#070d1b",
115
+ button_secondary_background_fill_dark="#070d1b",
116
+ border_color_primary_dark="#21293b",
117
+ background_fill_secondary_dark="#0f172a",
118
+ color_accent_soft_dark="transparent"
119
+ )) as demo:
120
+ gr.Markdown("# AI Prompt Engineering Tutor")
121
+ gr.Markdown("Master the art of crafting effective prompts")
122
+
123
+ with gr.Row():
124
+ gr.Image("https://huggingface.co/spaces/baconnier/Finance/resolve/main/banker.jpg", show_label=False, container=False)
125
+ with gr.Column():
126
+ gr.Image("https://huggingface.co/spaces/baconnier/Finance/resolve/main/banker_plus.jpg", show_label=False, container=False)
127
+ gr.Markdown("AI Prompt Engineering Tutor is trained to guide you through mastering prompt engineering techniques. Use this for learning purposes only.")
128
+
129
+ chatbot = gr.Chatbot(scale=1)
130
+ msg = gr.Textbox(label="Type your message here...")
131
+ clear = gr.Button("Clear")
132
+
133
+ msg.submit(respond, [msg, chatbot], chatbot)
134
+ clear.click(lambda: None, None, chatbot, queue=False)
135
 
136
  if __name__ == "__main__":
137
  demo.launch(share=True)