Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,9 @@ def chat_with_model(prompts):
|
|
21 |
return response['choices'][0]['message']['content']
|
22 |
|
23 |
def generate_filename(prompt):
|
24 |
-
safe_date_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
|
|
|
|
|
25 |
safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
|
26 |
return f"{safe_date_time}_{safe_prompt}.htm"
|
27 |
|
@@ -40,10 +42,12 @@ def main():
|
|
40 |
st.title("Chat with AI")
|
41 |
|
42 |
# Pre-defined prompts
|
43 |
-
prompts = ['Hows the weather?', 'Tell me a joke.', 'What is the meaning of life?']
|
|
|
44 |
|
45 |
# User prompt input
|
46 |
-
user_prompt = st.text_input("Your question:", '')
|
|
|
47 |
|
48 |
if user_prompt:
|
49 |
prompts.append(user_prompt)
|
|
|
21 |
return response['choices'][0]['message']['content']
|
22 |
|
23 |
def generate_filename(prompt):
|
24 |
+
# safe_date_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
|
25 |
+
safe_date_time = datetime.now().strftime("%m_%d_%H_%M") # short date format
|
26 |
+
|
27 |
safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
|
28 |
return f"{safe_date_time}_{safe_prompt}.htm"
|
29 |
|
|
|
42 |
st.title("Chat with AI")
|
43 |
|
44 |
# Pre-defined prompts
|
45 |
+
# prompts = ['Hows the weather?', 'Tell me a joke.', 'What is the meaning of life?']
|
46 |
+
prompts = ['']
|
47 |
|
48 |
# User prompt input
|
49 |
+
# user_prompt = st.text_input("Your question:", '')
|
50 |
+
user_prompt = st.text_area("Your question:", '', height=120)
|
51 |
|
52 |
if user_prompt:
|
53 |
prompts.append(user_prompt)
|