Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
import gspread
|
3 |
-
import torch_xla.core.xla_model as xm
|
4 |
from oauth2client.service_account import ServiceAccountCredentials
|
5 |
from llama_cpp import Llama
|
6 |
from llama_index.core import VectorStoreIndex, Settings
|
@@ -49,11 +48,8 @@ def read_google_sheets():
|
|
49 |
# 2️⃣ Inisialisasi Model Llama
|
50 |
# ===================================
|
51 |
def initialize_llama_model():
|
52 |
-
model_path = hf_hub_download(
|
53 |
-
|
54 |
-
filename="zephyr-7b-beta.Q4_K_M.gguf",
|
55 |
-
cache_dir="./models"
|
56 |
-
)
|
57 |
return model_path
|
58 |
|
59 |
# ===================================
|
@@ -135,14 +131,7 @@ def main():
|
|
135 |
def chatbot_response(message, history=None):
|
136 |
return generate_response(message, history, chat_engine)
|
137 |
|
138 |
-
|
139 |
-
xm.wait_device_ops()
|
140 |
-
|
141 |
-
gr.Interface(
|
142 |
-
fn=chatbot_response,
|
143 |
-
inputs=["text"],
|
144 |
-
outputs=["text"],
|
145 |
-
).launch()
|
146 |
|
147 |
if __name__ == "__main__":
|
148 |
main()
|
|
|
1 |
import gradio as gr
|
2 |
import gspread
|
|
|
3 |
from oauth2client.service_account import ServiceAccountCredentials
|
4 |
from llama_cpp import Llama
|
5 |
from llama_index.core import VectorStoreIndex, Settings
|
|
|
48 |
# 2️⃣ Inisialisasi Model Llama
|
49 |
# ===================================
|
50 |
def initialize_llama_model():
|
51 |
+
model_path = hf_hub_download("TheBLoke/zephyr-7b-beta-GGUF", "zephyr-7b-beta.Q4_K_M.gguf")
|
52 |
+
print(model_path)
|
|
|
|
|
|
|
53 |
return model_path
|
54 |
|
55 |
# ===================================
|
|
|
131 |
def chatbot_response(message, history=None):
|
132 |
return generate_response(message, history, chat_engine)
|
133 |
|
134 |
+
gr.Interface(fn=lambda x: x, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
main()
|