add
This commit is contained in:
parent
493d3b4b0e
commit
269f0ea664
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -1,3 +1,5 @@
|
|||
tensorflow
|
||||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
||||
tensorflow
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,4 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
||||
Pillow
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,24 @@
|
|||
import gradio as gr
|
||||
from transformers import pipeline, AutoTokenizer, AutoConfig, AutoModelForSequenceClassification
|
||||
|
||||
modelName="distilbert-base-uncased-finetuned-sst-2-english"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(modelName)
|
||||
model = AutoModelForSequenceClassification.from_pretrained(modelName)
|
||||
sentimentPipeline = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
||||
|
||||
def sentiment_analysis(text):
|
||||
results = sentimentPipeline(text)
|
||||
|
||||
return f"Sentiment: {results[0].get('label')}, Score: {results[0].get('score'):.2f}"
|
||||
|
||||
demo = gr.Interface(fn=sentiment_analysis,
|
||||
inputs='text',
|
||||
outputs='text',
|
||||
title = "文本情感分析"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo.queue(concurrency_count=3)
|
||||
demo.launch(server_name = "0.0.0.0", server_port = 7028)
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
|
@ -0,0 +1,10 @@
|
|||
FROM python:3.8.13
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["python", "app.py"]
|
|
@ -0,0 +1,3 @@
|
|||
gradio
|
||||
transformers
|
||||
torch
|
Loading…
Reference in New Issue