Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,18 +15,20 @@ def format_prompt(message, history):
|
|
15 |
return prompt
|
16 |
|
17 |
def generate(prompt, history, email):
|
18 |
-
if not email:
|
19 |
-
return "Please provide your email address to use the app."
|
20 |
-
|
21 |
generate_kwargs = dict(seed=42)
|
22 |
|
23 |
formatted_prompt = format_prompt(f"{prompt}", history)
|
24 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
25 |
output = ""
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
30 |
return output
|
31 |
|
32 |
|
|
|
15 |
return prompt
|
16 |
|
17 |
def generate(prompt, history, email):
|
|
|
|
|
|
|
18 |
generate_kwargs = dict(seed=42)
|
19 |
|
20 |
formatted_prompt = format_prompt(f"{prompt}", history)
|
21 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
22 |
output = ""
|
23 |
|
24 |
+
if not email:
|
25 |
+
for word in "Please provide your email address to use the app.".split():
|
26 |
+
output += word
|
27 |
+
yield output
|
28 |
+
else:
|
29 |
+
for response in stream:
|
30 |
+
output += response.token.text
|
31 |
+
yield output
|
32 |
return output
|
33 |
|
34 |
|