Spaces:
Runtime error
Runtime error
DHRUV SHEKHAWAT
commited on
Commit
·
2c0c6d3
1
Parent(s):
5d25c33
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,8 @@ if 'api_key' not in st.session_state:
|
|
| 23 |
st.session_state['api_key']=""
|
| 24 |
|
| 25 |
st.sidebar.title("Settings")
|
| 26 |
-
model_name = st.sidebar.selectbox("Model:", ("gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4-32k","falcon-180b-chat","claude-1","claude-2","palm-2","codellama-7b","llama2-7b","llama2-70b","openassistant-llama-30b","mini-orca-v3-13b"))
|
|
|
|
| 27 |
counter_placeholder = st.sidebar.empty()
|
| 28 |
|
| 29 |
api_key = st.sidebar.text_input("API_Key", value=st.session_state['api_key'], max_chars=None,placeholder=st.session_state['api_key'], key=None, type="password", label_visibility="visible")
|
|
@@ -100,7 +101,7 @@ def generate_response(prompt):
|
|
| 100 |
prompt = prompt.lower()
|
| 101 |
if prompt.startswith("draw"):
|
| 102 |
data = {"prompt": prompt.replace("draw",""),
|
| 103 |
-
"model":
|
| 104 |
}
|
| 105 |
|
| 106 |
response = requests.post("https://api.webraft.in/api/images/generations", json=data, headers=headers)
|
|
@@ -111,7 +112,7 @@ def generate_response(prompt):
|
|
| 111 |
|
| 112 |
response = response.json()
|
| 113 |
imageurl = response['data'][0]['url']
|
| 114 |
-
ie = f"Here is the generated image:\n {imageurl} \n \n Model used: `
|
| 115 |
st.session_state['messages'].append({"role": "assistant", "content": ie})
|
| 116 |
|
| 117 |
except requests.exceptions.JSONDecodeError as e:
|
|
|
|
| 23 |
st.session_state['api_key']=""
|
| 24 |
|
| 25 |
st.sidebar.title("Settings")
|
| 26 |
+
model_name = st.sidebar.selectbox("Chat Model:", ("gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-32k","falcon-180b-chat","claude-1","claude-2","palm-2","codellama-7b","llama2-7b","llama2-70b","openassistant-llama-30b","mini-orca-v3-13b"))
|
| 27 |
+
image_model = st.sidebar.selectbox("Image Model:", ("realistic-vision-v1-4","stable-diffusion-v1-4","stable-diffusion-v2-1","kandinsky-2.2","sdxl"))
|
| 28 |
counter_placeholder = st.sidebar.empty()
|
| 29 |
|
| 30 |
api_key = st.sidebar.text_input("API_Key", value=st.session_state['api_key'], max_chars=None,placeholder=st.session_state['api_key'], key=None, type="password", label_visibility="visible")
|
|
|
|
| 101 |
prompt = prompt.lower()
|
| 102 |
if prompt.startswith("draw"):
|
| 103 |
data = {"prompt": prompt.replace("draw",""),
|
| 104 |
+
"model": image_model
|
| 105 |
}
|
| 106 |
|
| 107 |
response = requests.post("https://api.webraft.in/api/images/generations", json=data, headers=headers)
|
|
|
|
| 112 |
|
| 113 |
response = response.json()
|
| 114 |
imageurl = response['data'][0]['url']
|
| 115 |
+
ie = f"Here is the generated image:\n {imageurl} \n \n Model used: `{model_name}`"
|
| 116 |
st.session_state['messages'].append({"role": "assistant", "content": ie})
|
| 117 |
|
| 118 |
except requests.exceptions.JSONDecodeError as e:
|