Alibrown commited on
Commit
6351821
·
verified ·
1 Parent(s): 94d6ea4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -36,7 +36,8 @@ def process_file(uploaded_file):
36
  if file_type in ["jpg", "jpeg", "png"]:
37
  return {"type": "image", "content": Image.open(uploaded_file).convert('RGB')}
38
 
39
- if file_type in ["txt", *code_extensions := ["html", "css", "php", "js", "py", "java", "c", "cpp"]]:
 
40
  return {"type": "text", "content": uploaded_file.read().decode("utf-8")}
41
 
42
  if file_type in ["csv", "xlsx"]:
@@ -57,18 +58,17 @@ def process_file(uploaded_file):
57
  with st.sidebar:
58
  api_key = st.text_input("Google AI API Key", type="password")
59
  model = st.selectbox("Model", [
60
- "gemini-1.5-flash",
61
- "gemini-1.5-pro",
62
- "gemini-1.5-flash-8B",
63
- "gemini-1.5-pro-vision-latest",
64
- "gemini-1.0-pro",
65
- "gemini-1.0-pro-vision-latest",
66
-
67
- "gemini-2.0-pro-exp-02-05",
68
- "gemini-2.0-flash-lite",
69
- "gemini-2.0-flash-exp-image-generation",
70
- "gemini-2.0-flash",
71
- "gemini-2.0-flash-thinking-exp-01-21"
72
  ])
73
  temperature = st.slider("Temperature", 0.0, 1.0, 0.7)
74
  max_tokens = st.slider("Max Tokens", 1, 2048, 1000)
 
36
  if file_type in ["jpg", "jpeg", "png"]:
37
  return {"type": "image", "content": Image.open(uploaded_file).convert('RGB')}
38
 
39
+ code_extensions = ["html", "css", "php", "js", "py", "java", "c", "cpp"]
40
+ if file_type in ["txt"] + code_extensions:
41
  return {"type": "text", "content": uploaded_file.read().decode("utf-8")}
42
 
43
  if file_type in ["csv", "xlsx"]:
 
58
  with st.sidebar:
59
  api_key = st.text_input("Google AI API Key", type="password")
60
  model = st.selectbox("Model", [
61
+ "gemini-1.5-flash",
62
+ "gemini-1.5-pro",
63
+ "gemini-1.5-flash-8B",
64
+ "gemini-1.5-pro-vision-latest",
65
+ "gemini-1.0-pro",
66
+ "gemini-1.0-pro-vision-latest",
67
+ "gemini-2.0-pro-exp-02-05",
68
+ "gemini-2.0-flash-lite",
69
+ "gemini-2.0-flash-exp-image-generation",
70
+ "gemini-2.0-flash",
71
+ "gemini-2.0-flash-thinking-exp-01-21"
 
72
  ])
73
  temperature = st.slider("Temperature", 0.0, 1.0, 0.7)
74
  max_tokens = st.slider("Max Tokens", 1, 2048, 1000)