Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -88,17 +88,22 @@ def generate(prompt, history=[], temperature=0.1, max_new_tokens=10000, top_p=0.
|
|
88 |
output_accumulated += output_part
|
89 |
yield output_accumulated + f"\n\n---\nTotal tokens used: {total_tokens_used}\nStock Data: {stock_data}"
|
90 |
else:
|
91 |
-
yield "μ
λ ₯νμ
|
92 |
except Exception as e:
|
93 |
yield f"Error: {str(e)}\nTotal tokens used: {total_tokens_used}"
|
94 |
|
95 |
# μ’
λͺ©λͺ
μ ν λλ‘ ν°μ»€μ κΈ°μ
μ 보λ₯Ό μ 곡νλ ν¨μ
|
96 |
def get_stock_info(name):
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
102 |
mychatbot = gr.Chatbot(
|
103 |
avatar_images=["./user.png", "./botm.png"],
|
104 |
bubble_full_width=False,
|
|
|
88 |
output_accumulated += output_part
|
89 |
yield output_accumulated + f"\n\n---\nTotal tokens used: {total_tokens_used}\nStock Data: {stock_data}"
|
90 |
else:
|
91 |
+
yield f"μ
λ ₯νμ '{prompt}'μ(λ) μ§μλλ μ’
λͺ©λͺ
μ΄ μλλλ€. νμ¬ μ§μλλ μ’
λͺ©μ μ ν, λ§μ΄ν¬λ‘μννΈ, μλ§μ‘΄, μνλ²³ (ꡬκΈ), ν
μ¬λΌ λ±μ
λλ€. μ νν μ’
λͺ©λͺ
μ μ
λ ₯ν΄μ£ΌμΈμ."
|
92 |
except Exception as e:
|
93 |
yield f"Error: {str(e)}\nTotal tokens used: {total_tokens_used}"
|
94 |
|
95 |
# μ’
λͺ©λͺ
μ ν λλ‘ ν°μ»€μ κΈ°μ
μ 보λ₯Ό μ 곡νλ ν¨μ
|
96 |
def get_stock_info(name):
|
97 |
+
stock_info = {
|
98 |
+
"apple": {'ticker': 'AAPL', 'name': 'μ ν', 'description': 'μμ΄ν°μ'},
|
99 |
+
"microsoft": {'ticker': 'MSFT', 'name': 'λ§μ΄ν¬λ‘μννΈ', 'description': 'μλμ° μ΄μ체μ μ μ€νΌμ€ μννΈμ¨μ΄λ₯Ό'},
|
100 |
+
"amazon": {'ticker': 'AMZN', 'name': 'μλ§μ‘΄', 'description': 'μ μμκ±°λ λ° ν΄λΌμ°λ μλΉμ€λ₯Ό'},
|
101 |
+
"google": {'ticker': 'GOOGL', 'name': 'μνλ²³ (ꡬκΈ)', 'description': 'κ²μ μμ§ λ° μ¨λΌμΈ κ΄κ³ λ₯Ό'},
|
102 |
+
"tesla": {'ticker': 'TSLA', 'name': 'ν
μ¬λΌ', 'description': 'μ κΈ°μλμ°¨μ μλμ§ μ μ₯μ₯μΉλ₯Ό'},
|
103 |
+
# μΆκ°μ μΈ μ’
λͺ©μ λν μ 보λ₯Ό μ΄κ³³μ ꡬνν μ μμ΅λλ€.
|
104 |
+
}
|
105 |
+
return stock_info.get(name.lower(), {'ticker': None, 'name': name, 'description': ''})
|
106 |
+
|
107 |
mychatbot = gr.Chatbot(
|
108 |
avatar_images=["./user.png", "./botm.png"],
|
109 |
bubble_full_width=False,
|