Spaces:
Build error
Build error
autonomous019
commited on
Commit
•
203d6b2
1
Parent(s):
62baf56
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,35 @@
|
|
1 |
-
from transformers import ViTConfig, ViTForImageClassification
|
2 |
-
from transformers import ViTFeatureExtractor
|
3 |
from PIL import Image
|
4 |
import requests
|
5 |
import matplotlib.pyplot as plt
|
6 |
import gradio as gr
|
7 |
from gradio.mix import Parallel
|
8 |
-
from transformers import ImageClassificationPipeline, PerceiverForImageClassificationConvProcessing, PerceiverFeatureExtractor
|
9 |
-
from transformers import VisionEncoderDecoderModel
|
10 |
-
from transformers import AutoTokenizer
|
11 |
import torch
|
12 |
from transformers import (
|
|
|
|
|
|
|
13 |
AutoModelForCausalLM,
|
14 |
LogitsProcessorList,
|
15 |
MinLengthLogitsProcessor,
|
16 |
StoppingCriteriaList,
|
17 |
MaxLengthCriteria,
|
|
|
|
|
|
|
|
|
|
|
18 |
)
|
19 |
import json
|
20 |
import os
|
21 |
-
|
22 |
from spaces_info import description, examples, initial_prompt_value
|
23 |
|
|
|
24 |
API_URL = os.getenv("API_URL")
|
25 |
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
|
26 |
-
|
27 |
##Bloom Inference API
|
28 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
29 |
-
HF_API_TOKEN = os.environ["HF_API_TOKEN"]
|
30 |
headers = {"Authorization": f"Bearer {HF_API_TOKEN}"}
|
31 |
|
32 |
print(API_URL)
|
|
|
|
|
|
|
1 |
from PIL import Image
|
2 |
import requests
|
3 |
import matplotlib.pyplot as plt
|
4 |
import gradio as gr
|
5 |
from gradio.mix import Parallel
|
|
|
|
|
|
|
6 |
import torch
|
7 |
from transformers import (
|
8 |
+
ViTConfig,
|
9 |
+
ViTForImageClassification,
|
10 |
+
ViTFeatureExtractor,
|
11 |
AutoModelForCausalLM,
|
12 |
LogitsProcessorList,
|
13 |
MinLengthLogitsProcessor,
|
14 |
StoppingCriteriaList,
|
15 |
MaxLengthCriteria,
|
16 |
+
ImageClassificationPipeline,
|
17 |
+
PerceiverForImageClassificationConvProcessing,
|
18 |
+
PerceiverFeatureExtractor,
|
19 |
+
VisionEncoderDecoderModel,
|
20 |
+
AutoTokenizer,
|
21 |
)
|
22 |
import json
|
23 |
import os
|
24 |
+
#get from local file spaces_info.py
|
25 |
from spaces_info import description, examples, initial_prompt_value
|
26 |
|
27 |
+
#some constants
|
28 |
API_URL = os.getenv("API_URL")
|
29 |
HF_API_TOKEN = os.getenv("HF_API_TOKEN")
|
|
|
30 |
##Bloom Inference API
|
31 |
API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
32 |
+
#HF_API_TOKEN = os.environ["HF_API_TOKEN"]
|
33 |
headers = {"Authorization": f"Bearer {HF_API_TOKEN}"}
|
34 |
|
35 |
print(API_URL)
|