mrbeliever commited on
Commit
4b8df20
·
verified ·
1 Parent(s): 4fced06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -29
app.py CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
4
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
5
 
6
  # Your system prompt
7
- SYSTEM_PROMPT = "You are a prompt enhancer and your work is to enhance the given prompt under 100 words without changing the essence, only write the enhanced prompt and nothing else"
8
 
9
  def format_prompt(message, history=[]):
10
  prompt = "<s>"
@@ -40,32 +40,12 @@ def generate(prompt, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition
40
  yield output.strip('</s>')
41
  return output.strip('</s>')
42
 
43
- def dark_theme():
44
- return """
45
- body {
46
- background-color: #121212;
47
- color: #ffffff;
48
- }
49
- .gradio-container {
50
- background-color: #121212;
51
- color: #ffffff;
52
- }
53
- input, textarea, select {
54
- background-color: #333333 !important;
55
- color: #ffffff !important;
56
- border-color: #555555 !important;
57
- }
58
- .gradio-container button {
59
- background-color: #555555 !important;
60
- color: #ffffff !important;
61
- }
62
- """
63
 
64
- with gr.Interface(
65
- fn=generate,
66
- inputs=gr.Textbox(placeholder="Enter your prompt here...", label="Prompt"),
67
- outputs=gr.Textbox(label="Output", interactive=True, lines=10),
68
- theme="compact", # Use compact theme for default layout
69
- css=dark_theme() # Apply dark theme styles
70
- ) as app:
71
- app.launch()
 
4
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
5
 
6
  # Your system prompt
7
+ SYSTEM_PROMPT = "Enhance and rewrite the prompt in sentence form without changing the essence"
8
 
9
  def format_prompt(message, history=[]):
10
  prompt = "<s>"
 
40
  yield output.strip('</s>')
41
  return output.strip('</s>')
42
 
43
+ with gr.Blocks() as demo:
44
+ input_text = gr.Textbox(placeholder="Enter your prompt here...", lines=2, max_lines=2, label="Prompt")
45
+ submit_button = gr.Button("Generate")
46
+ output_text = gr.Textbox(label="Output", interactive=True, lines=10)
47
+
48
+
49
+ submit_button.click(fn=generate, inputs=input_text, outputs=output_text)
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
+ demo.launch()