Update app.py
Browse files
app.py
CHANGED
@@ -1,43 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
-
|
4 |
-
"""
|
5 |
-
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
-
"""
|
7 |
-
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
-
|
9 |
-
# -*- coding: utf-8 -*-
|
10 |
-
"""juri_chatbot.ipynb
|
11 |
-
|
12 |
-
Automatically generated by Colab.
|
13 |
-
|
14 |
-
Original file is located at
|
15 |
-
https://colab.research.google.com/drive/1o40EH1zkgiGTxJERwU7Tr2b2hb5DPdLX
|
16 |
-
"""
|
17 |
-
|
18 |
-
from google.colab import drive
|
19 |
-
drive.mount('/content/gdrive')
|
20 |
-
|
21 |
-
if torch.cuda.is_available():
|
22 |
-
print("CUDA is available! 🚀")
|
23 |
-
num_gpus = torch.cuda.device_count()
|
24 |
-
print(f"Number of available GPUs: {num_gpus}")
|
25 |
-
devices = [torch.device(f"cuda:{i}") for i in range(num_gpus)]
|
26 |
-
else:
|
27 |
-
print("CUDA is not available. Switching to CPU.")
|
28 |
-
devices = [torch.device("cpu")]
|
29 |
-
|
30 |
-
print("Selected devices:", devices)
|
31 |
-
|
32 |
-
pip install gradio
|
33 |
-
|
34 |
-
pip install sentence_transformers
|
35 |
-
|
36 |
-
import gradio as gr
|
37 |
import pandas as pd
|
38 |
import transformers
|
39 |
import torch
|
40 |
from sentence_transformers import SentenceTransformer, util
|
|
|
|
|
|
|
|
|
41 |
|
42 |
# Load the SBERT model
|
43 |
sbert_model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import pandas as pd
|
4 |
import transformers
|
5 |
import torch
|
6 |
from sentence_transformers import SentenceTransformer, util
|
7 |
+
"""
|
8 |
+
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
9 |
+
"""
|
10 |
+
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
11 |
|
12 |
# Load the SBERT model
|
13 |
sbert_model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|