haoqi7 commited on
Commit
38c6288
·
1 Parent(s): c4a0365

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -5,7 +5,7 @@ import openai
5
 
6
  #页面设置
7
  st.set_page_config(
8
- page_title="小译学长|AI对话一问一答模式",
9
  page_icon=":robot:"
10
  )
11
  st.header("🔥AI对话一问一答模式")
@@ -24,9 +24,6 @@ openai_key = get_text1()
24
  if openai_key:
25
  openai.api_key = openai_key
26
  st.write("")
27
- else:
28
- st.write("⚒️账号获取方式:扫描下方二维码或搜索关注微信公众号【正经人王同学】回复【小译学长】获取你的账号,然后将公共账号输入到此处,再两次点击【确认登陆!】就好")
29
- st.image('https://pic4.zhimg.com/v2-401dd67cf027f85f53e4be3bd28dab5f_b.jpg')
30
 
31
  # openAI code
32
  def openai_create(prompt):
@@ -48,7 +45,7 @@ def openai_create(prompt):
48
  # except openai.error.UnauthorizedError:
49
  # return "API Key不正确,请输入正确的API Key。"
50
  # except openai.error.RateLimitError:
51
- # Error="当前小译学长访问量过大,请过一段时间再试!开发者正在努力扩张服务能力,敬请期待!"
52
  # return Error
53
 
54
  except Exception as e:
@@ -61,14 +58,14 @@ def chatgpt_clone(input):
61
 
62
  # Streamlit App
63
  # st.set_page_config(
64
- # page_title="小译AI对话单轮版",
65
  # page_icon=":robot:"
66
  # )
67
 
68
 
69
 
70
 
71
- # st.header("🏅和小译学长聊聊天")
72
 
73
  if 'generated' not in st.session_state:
74
  st.session_state['generated'] = []
@@ -78,12 +75,11 @@ if 'past' not in st.session_state:
78
 
79
 
80
  def get_text():
81
- input_text = st.text_input("📫请告诉小译学长你想说的吧: ", key="input1")
82
  if st.button("发送", key="input2"):
83
  return input_text
84
  return None
85
 
86
- st.markdown("""[正经人王同学|公众号](https://mp.weixin.qq.com/s?__biz=Mzg3ODcwNzk3Nw==&mid=2247485615&idx=1&sn=c691d496386b5972e36fea8eaee33b97&chksm=cf0edcc9f87955df95fa23a716d78d496e7456183da7cfa6b348db6988865da9060896abcdcd&token=1164458978&lang=zh_CN#rd) [抖音](https://www.douyin.com/user/MS4wLjABAAAAIdY0VlMSK0Shyd4FxHBgkXAtH4Zq8wsuKzIuSICWpy0) [小红书 ](https://www.xiaohongshu.com/user/profile/5f12a46a000000000101ff27)""")
87
 
88
  user_input = get_text()
89
 
 
5
 
6
  #页面设置
7
  st.set_page_config(
8
+ page_title="AI对话一问一答模式",
9
  page_icon=":robot:"
10
  )
11
  st.header("🔥AI对话一问一答模式")
 
24
  if openai_key:
25
  openai.api_key = openai_key
26
  st.write("")
 
 
 
27
 
28
  # openAI code
29
  def openai_create(prompt):
 
45
  # except openai.error.UnauthorizedError:
46
  # return "API Key不正确,请输入正确的API Key。"
47
  # except openai.error.RateLimitError:
48
+ # Error="当前访问量过大,请过一段时间再试!开发者正在努力扩张服务能力,敬请期待!"
49
  # return Error
50
 
51
  except Exception as e:
 
58
 
59
  # Streamlit App
60
  # st.set_page_config(
61
+ # page_title="AI对话单轮版",
62
  # page_icon=":robot:"
63
  # )
64
 
65
 
66
 
67
 
68
+ # st.header("🏅聊天")
69
 
70
  if 'generated' not in st.session_state:
71
  st.session_state['generated'] = []
 
75
 
76
 
77
  def get_text():
78
+ input_text = st.text_input("📫你想说的: ", key="input1")
79
  if st.button("发送", key="input2"):
80
  return input_text
81
  return None
82
 
 
83
 
84
  user_input = get_text()
85