Dagfinn1962 commited on
Commit
262db44
1 Parent(s): 3d86b1f

Update app1.py

Browse files
Files changed (1) hide show
  1. app1.py +27 -14
app1.py CHANGED
@@ -1,8 +1,20 @@
 
1
  import time
2
  import logging
3
  import gradio as gr
4
-
5
  from src.llm_boilers import llm_boiler
 
 
 
 
 
 
 
 
 
 
 
6
 
7
 
8
  logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)
@@ -111,33 +123,34 @@ def call_inf_server(prompt, openai_key):
111
  return response
112
 
113
 
114
- with gr.Blocks(
115
- theme=gr.themes.Glass(
116
- primary_hue="lime",
117
- secondary_hue="emerald",
118
- neutral_hue="zinc",
119
-
120
- ),
121
 
122
- ) as demo:
123
 
124
 
125
  gr.Markdown(
126
- """<h1><center>Chat with gpt-3.5-turbo</center></h1>
127
- This is a lightweight demo of gpt-3.5-turbo conversation completion. It was designed as a template for in-context learning applications to be built on top of.
 
 
128
  """
129
- )
130
  conversation = Chat()
131
  with gr.Row():
132
  with gr.Column():
133
  # to do: change to openaikey input for public release
134
  openai_key = gr.Textbox(
135
  label="OpenAI Key",
136
- value="",
137
  type="password",
138
- placeholder="sk..",
139
  info="You have to provide your own OpenAI API key.",
140
  )
 
141
  chatbot = gr.Chatbot().style(height=400)
142
  with gr.Row():
143
  with gr.Column():
 
1
+ import openai
2
  import time
3
  import logging
4
  import gradio as gr
5
+ import os
6
  from src.llm_boilers import llm_boiler
7
+ import configparser
8
+
9
+ # Read the configuration file
10
+ config = configparser.ConfigParser()
11
+ config.read('config.ini')
12
+
13
+ # Get the OpenAI key from the configuration file
14
+ openai_key = config.get('Credentials', 'openai_key')
15
+
16
+ # Use openai_key in your code
17
+
18
 
19
 
20
  logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)
 
123
  return response
124
 
125
 
126
+ with gr.Blocks(theme='HaleyCH/HaleyCH_Theme') as demo:
127
+ # org :
128
+ #theme=gr.themes.Glass(
129
+ #primary_hue="lime",
130
+ #secondary_hue="emerald",
131
+ #neutral_hue="zinc",
 
132
 
 
133
 
134
 
135
  gr.Markdown(
136
+ """
137
+ <br><h1><center>Chat with gpt-3.5-turbo</center></h1>
138
+ This is a lightweight gpt-3.5-turbo conversation
139
+ completion.
140
  """
141
+ )
142
  conversation = Chat()
143
  with gr.Row():
144
  with gr.Column():
145
  # to do: change to openaikey input for public release
146
  openai_key = gr.Textbox(
147
  label="OpenAI Key",
148
+ value="",
149
  type="password",
150
+ placeholder="os.environ.get('openai_key')",
151
  info="You have to provide your own OpenAI API key.",
152
  )
153
+
154
  chatbot = gr.Chatbot().style(height=400)
155
  with gr.Row():
156
  with gr.Column():