Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
|
| 4 |
# Wczytanie tokena z pliku konfiguracyjnego
|
| 5 |
with open("config.txt", "r") as f:
|
|
@@ -15,7 +15,7 @@ repo_type = config.get("repo_type", "")
|
|
| 15 |
token = config.get("token", "")
|
| 16 |
|
| 17 |
# Utworzenie folderu Hugging Face z tokenem uwierzytelniającym
|
| 18 |
-
hf_folder = HfFolder(
|
| 19 |
|
| 20 |
# Wczytanie własnego modelu chatbota z Hugging Face
|
| 21 |
if model_name == "pp3232133/pp3232133-distilgpt2-wikitext2":
|
|
@@ -37,11 +37,10 @@ if model_name == "pp3232133/pp3232133-distilgpt2-wikitext2":
|
|
| 37 |
title="Chatbot",
|
| 38 |
description="Custom chatbot based on your Hugging Face model. Start typing to chat with the bot.",
|
| 39 |
theme="compact"
|
| 40 |
-
|
| 41 |
|
| 42 |
# Uruchomienie interfejsu
|
| 43 |
iface.launch()
|
| 44 |
|
| 45 |
-
|
| 46 |
else:
|
| 47 |
-
print("Nie można znaleźć nazwy modelu w pliku konfiguracyjnym.")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, HfFolder
|
| 3 |
|
| 4 |
# Wczytanie tokena z pliku konfiguracyjnego
|
| 5 |
with open("config.txt", "r") as f:
|
|
|
|
| 15 |
token = config.get("token", "")
|
| 16 |
|
| 17 |
# Utworzenie folderu Hugging Face z tokenem uwierzytelniającym
|
| 18 |
+
hf_folder = HfFolder(model_name, repo_type, token=token)
|
| 19 |
|
| 20 |
# Wczytanie własnego modelu chatbota z Hugging Face
|
| 21 |
if model_name == "pp3232133/pp3232133-distilgpt2-wikitext2":
|
|
|
|
| 37 |
title="Chatbot",
|
| 38 |
description="Custom chatbot based on your Hugging Face model. Start typing to chat with the bot.",
|
| 39 |
theme="compact"
|
| 40 |
+
)
|
| 41 |
|
| 42 |
# Uruchomienie interfejsu
|
| 43 |
iface.launch()
|
| 44 |
|
|
|
|
| 45 |
else:
|
| 46 |
+
print("Nie można znaleźć nazwy modelu w pliku konfiguracyjnym.")
|