seawolf2357 commited on
Commit
c32ace2
Β·
verified Β·
1 Parent(s): 15d067c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
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
- if name.lower() == "apple":
98
- return {'ticker': 'AAPL', 'name': 'μ• ν”Œ', 'description': '아이폰을'}
99
- # 좔가적인 μ’…λͺ©μ— λŒ€ν•œ 정보λ₯Ό 이곳에 κ΅¬ν˜„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
100
- return {'ticker': None, 'name': name, 'description': ''}
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,