Spaces:
Running
on
Zero
Running
on
Zero
Man-isH-07
commited on
Commit
·
954052f
1
Parent(s):
f69fd20
test_1
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title: Mistral
|
3 |
emoji: 🐨
|
4 |
colorFrom: pink
|
5 |
colorTo: blue
|
|
|
1 |
---
|
2 |
+
title: Mistral-7B
|
3 |
emoji: 🐨
|
4 |
colorFrom: pink
|
5 |
colorTo: blue
|
app.py
CHANGED
@@ -59,10 +59,36 @@ def generate(
|
|
59 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
60 |
t.start()
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
|
68 |
demo = gr.ChatInterface(
|
|
|
59 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
60 |
t.start()
|
61 |
|
62 |
+
try:
|
63 |
+
# Split the message into lines
|
64 |
+
lines = message.split("\n")
|
65 |
+
positive_prompt = ""
|
66 |
+
negative_prompt = ""
|
67 |
+
|
68 |
+
# Look for the Positive and Negative prompts
|
69 |
+
for line in lines:
|
70 |
+
if line.startswith("Positive Prompt:"):
|
71 |
+
positive_prompt = line.replace("Positive Prompt:", "").strip()
|
72 |
+
elif line.startswith("Negative Prompt:"):
|
73 |
+
negative_prompt = line.replace("Negative Prompt:", "").strip()
|
74 |
+
|
75 |
+
# If the prompts weren't found, use a fallback
|
76 |
+
if not positive_prompt or not negative_prompt:
|
77 |
+
positive_prompt = "Positive prompt not found."
|
78 |
+
negative_prompt = "Negative prompt not found."
|
79 |
+
except Exception as e:
|
80 |
+
# Fallback in case of parsing errors
|
81 |
+
positive_prompt = "Error parsing positive prompt."
|
82 |
+
negative_prompt = "Error parsing negative prompt."
|
83 |
+
|
84 |
+
# Wrap the prompts in HTML divs with specific classes
|
85 |
+
output = (
|
86 |
+
f'<div class="positive-prompt"><strong>Positive Prompt:</strong><br>{positive_prompt}</div>'
|
87 |
+
f'<div class="negative-prompt"><strong>Negative Prompt:</strong><br>{negative_prompt}</div>'
|
88 |
+
)
|
89 |
+
|
90 |
+
# Yield the formatted output
|
91 |
+
yield output
|
92 |
|
93 |
|
94 |
demo = gr.ChatInterface(
|
style.css
CHANGED
@@ -9,3 +9,23 @@ h1 {
|
|
9 |
background: #1565c0;
|
10 |
border-radius: 100vh;
|
11 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
background: #1565c0;
|
10 |
border-radius: 100vh;
|
11 |
}
|
12 |
+
|
13 |
+
|
14 |
+
/* Style for the positive prompt box */
|
15 |
+
.positive-prompt {
|
16 |
+
background-color: #2a2a2a; /* Dark background to match the theme */
|
17 |
+
border: 1px solid #444; /* Subtle border */
|
18 |
+
border-radius: 8px;
|
19 |
+
padding: 15px;
|
20 |
+
margin-bottom: 10px; /* Space between the two boxes */
|
21 |
+
color: #ffffff; /* White text for readability */
|
22 |
+
}
|
23 |
+
|
24 |
+
/* Style for the negative prompt box */
|
25 |
+
.negative-prompt {
|
26 |
+
background-color: #2a2a2a;
|
27 |
+
border: 1px solid #444;
|
28 |
+
border-radius: 8px;
|
29 |
+
padding: 15px;
|
30 |
+
color: #ffffff;
|
31 |
+
}
|