NotASI commited on
Commit
250b0b9
·
1 Parent(s): a05cc1e

Remove unused code

Browse files
Files changed (1) hide show
  1. Tabs/Gemini_Chabot_Nightly.py +1 -91
Tabs/Gemini_Chabot_Nightly.py CHANGED
@@ -1,93 +1,3 @@
1
- # import os
2
- # import google.generativeai as genai
3
- # from google.generativeai.types import HarmCategory, HarmBlockThreshold
4
- # import gradio as gr
5
- # from dotenv import load_dotenv
6
-
7
- # load_dotenv()
8
-
9
- # GEMINI_API_KEY_NIGHTLY = os.getenv("GEMINI_API_KEY_NIGHTLY")
10
- # model_name = "gemini-1.5-flash"
11
-
12
- # TITLE_NIGHTLY = """<h1 align="center">🎮Chat with Gemini 1.5🔥 -- Nightly</h1>"""
13
- # NOTICE_NIGHTLY = """
14
- # Notices 📜:
15
- # - This app is still in development (extreme unstable)
16
- # - Some features may not work as expected
17
- # - Currently the chatbot only support text and images
18
- # """
19
- # ERROR_NIGHTLY = """
20
- # Known errors ⚠️:
21
- # - Error when submit messages from uploading files.
22
- # """
23
-
24
- # def upload_to_gemini(path, mime_type=None):
25
- # file = genai.upload_file(path, mime_type=mime_type)
26
- # print(f"Uploaded file '{file.display_name}' as: {file.uri}")
27
- # return file
28
-
29
- # def transform_history(history):
30
- # new_history = []
31
- # for user_msg, model_msg in history:
32
- # new_history.append({"role": "user", "parts": [{"text": user_msg}]})
33
- # new_history.append({"role": "model", "parts": [{"text": model_msg}]})
34
- # return new_history
35
-
36
- # def chatbot_stable(message, history):
37
- # message_text = message["text"]
38
- # message_files = message["files"]
39
- # print("Message text:", message_text)
40
- # print("Message files:", message_files)
41
- # if message_files:
42
- # image_uris = [upload_to_gemini(file_path["path"]) for file_path in message_files]
43
- # message_content = [{"text": message_text}] + image_uris
44
- # else:
45
- # message_content = {"text": message_text}
46
- # genai.configure(api_key=GEMINI_API_KEY_NIGHTLY)
47
- # model = genai.GenerativeModel(
48
- # model_name,
49
- # safety_settings={
50
- # HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_ONLY_HIGH,
51
- # HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_ONLY_HIGH,
52
- # HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_ONLY_HIGH,
53
- # HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_ONLY_HIGH,
54
- # },
55
- # generation_config={
56
- # "temperature": 1,
57
- # "top_p": 0.95,
58
- # "top_k": 64,
59
- # "max_output_tokens": 8192,
60
- # "response_mime_type": "text/plain",
61
- # }
62
- # )
63
-
64
- # global chat
65
- # chat = model.start_chat(history=[])
66
- # chat.history = transform_history(history)
67
- # response = chat.send_message(message_content, stream=True)
68
- # response.resolve()
69
-
70
- # return response.text
71
-
72
- # gemini_chatbot_interface_stable = gr.Chatbot(
73
- # height=500,
74
- # likeable=True,
75
- # avatar_images=(
76
- # None,
77
- # "https://media.roboflow.com/spaces/gemini-icon.png"
78
- # ),
79
- # show_copy_button=True,
80
- # show_share_button=True,
81
- # render_markdown=True
82
- # )
83
-
84
- # gemini_chatbot_stable = gr.ChatInterface(
85
- # fn=chatbot_stable,
86
- # chatbot=gemini_chatbot_interface_stable,
87
- # title="Gemini 1.5 Chatbot",
88
- # multimodal=True
89
- # )
90
-
91
  import os
92
  import google.generativeai as genai
93
  from google.generativeai.types import HarmCategory, HarmBlockThreshold
@@ -108,7 +18,7 @@ Notices 📜:
108
  """
109
  ERROR_NIGHTLY = """
110
  Known errors ⚠️:
111
- - Error when submit messages from uploading files.
112
  """
113
 
114
  genai.configure(api_key=GEMINI_API_KEY_NIGHTLY)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import google.generativeai as genai
3
  from google.generativeai.types import HarmCategory, HarmBlockThreshold
 
18
  """
19
  ERROR_NIGHTLY = """
20
  Known errors ⚠️:
21
+ - Error when submit messages from uploading files. (**Fixed**)
22
  """
23
 
24
  genai.configure(api_key=GEMINI_API_KEY_NIGHTLY)