Spaces:
Sleeping
Sleeping
Adding files.
Browse files- Readme.md +7 -6
- app.py +14 -0
- docker-compose.yml +0 -96
- requirements.txt +4 -0
Readme.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
title: IMDb Sentiment Analysis
|
2 |
-
emoji:
|
3 |
-
colorFrom:
|
4 |
-
colorTo:
|
5 |
-
sdk:
|
6 |
-
sdk_version:
|
7 |
app_file: app.py
|
8 |
-
pinned: false
|
|
|
|
1 |
title: IMDb Sentiment Analysis
|
2 |
+
emoji: 📚
|
3 |
+
colorFrom: pink
|
4 |
+
colorTo: gray
|
5 |
+
sdk: gradio
|
6 |
+
sdk_version: 4.36.1
|
7 |
app_file: app.py
|
8 |
+
pinned: false
|
9 |
+
license: apache-2.0
|
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the pre-trained sentiment-analysis pipeline
|
5 |
+
classifier = pipeline('sentiment-analysis')
|
6 |
+
|
7 |
+
# Function to classify sentiment
|
8 |
+
def classify_text(text):
|
9 |
+
result = classifier(text)[0]
|
10 |
+
return f"{result['label']} with score {result['score']}"
|
11 |
+
|
12 |
+
# Set up the Gradio interface
|
13 |
+
iface = gr.Interface(fn=classify_text, inputs="text", outputs="text")
|
14 |
+
iface.launch()
|
docker-compose.yml
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
version: '3.8'
|
2 |
-
|
3 |
-
services:
|
4 |
-
zookeeper:
|
5 |
-
image: confluentinc/cp-zookeeper:latest
|
6 |
-
environment:
|
7 |
-
ZOOKEEPER_CLIENT_PORT: 2181
|
8 |
-
ZOOKEEPER_TICK_TIME: 2000
|
9 |
-
ports:
|
10 |
-
- "2181:2181"
|
11 |
-
|
12 |
-
kafka:
|
13 |
-
image: confluentinc/cp-kafka:latest
|
14 |
-
depends_on:
|
15 |
-
- zookeeper
|
16 |
-
environment:
|
17 |
-
KAFKA_BROKER_ID: 1
|
18 |
-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
19 |
-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,OUTSIDE://host.docker.internal:9093
|
20 |
-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,OUTSIDE:PLAINTEXT
|
21 |
-
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
22 |
-
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
23 |
-
ports:
|
24 |
-
- "9092:9092"
|
25 |
-
- "9093:9093"
|
26 |
-
|
27 |
-
schema-registry:
|
28 |
-
image: confluentinc/cp-schema-registry:latest
|
29 |
-
depends_on:
|
30 |
-
- kafka
|
31 |
-
environment:
|
32 |
-
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
|
33 |
-
SCHEMA_REGISTRY_HOST_NAME: schema-registry
|
34 |
-
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
|
35 |
-
ports:
|
36 |
-
- "8081:8081"
|
37 |
-
|
38 |
-
control-center:
|
39 |
-
image: confluentinc/cp-enterprise-control-center:latest
|
40 |
-
depends_on:
|
41 |
-
- kafka
|
42 |
-
- schema-registry
|
43 |
-
environment:
|
44 |
-
CONTROL_CENTER_BOOTSTRAP_SERVERS: kafka:9092
|
45 |
-
CONTROL_CENTER_ZOOKEEPER_CONNECT: zookeeper:2181
|
46 |
-
CONTROL_CENTER_SCHEMA_REGISTRY_URL: http://schema-registry:8081
|
47 |
-
CONTROL_CENTER_REPLICATION_FACTOR: 1
|
48 |
-
CONTROL_CENTER_INTERNAL_TOPICS_PARTITIONS: 1
|
49 |
-
CONTROL_CENTER_MONITORING_INTERCEPTOR_TOPIC_PARTITIONS: 1
|
50 |
-
CONTROL_CENTER_CONNECT_CLUSTER: http://localhost:8083
|
51 |
-
ports:
|
52 |
-
- "9021:9021"
|
53 |
-
|
54 |
-
kafka-init:
|
55 |
-
image: confluentinc/cp-kafka:latest
|
56 |
-
depends_on:
|
57 |
-
- kafka
|
58 |
-
entrypoint: ["/bin/sh", "-c", "cub kafka-ready -b kafka:9092 1 20 && kafka-topics --create --topic order-topic --partitions 1 --replication-factor 1 --if-not-exists --bootstrap-server kafka:9092 && kafka-topics --create --topic calculation-requests --partitions 1 --replication-factor 1 --if-not-exists --bootstrap-server kafka:9092"]
|
59 |
-
environment:
|
60 |
-
LOG_DIR: /tmp
|
61 |
-
|
62 |
-
order-service:
|
63 |
-
build:
|
64 |
-
context: ./order-service
|
65 |
-
dockerfile: Dockerfile
|
66 |
-
depends_on:
|
67 |
-
- kafka
|
68 |
-
environment:
|
69 |
-
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
|
70 |
-
SPRING_DATASOURCE_URL: jdbc:h2:mem:testdb
|
71 |
-
ports:
|
72 |
-
- "8081:8081"
|
73 |
-
|
74 |
-
inventory-service:
|
75 |
-
build:
|
76 |
-
context: ./inventory-service
|
77 |
-
dockerfile: Dockerfile
|
78 |
-
depends_on:
|
79 |
-
- kafka
|
80 |
-
environment:
|
81 |
-
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
|
82 |
-
SPRING_DATASOURCE_URL: jdbc:h2:mem:testdb
|
83 |
-
ports:
|
84 |
-
- "8082:8082"
|
85 |
-
|
86 |
-
calculator-service:
|
87 |
-
build:
|
88 |
-
context: ./calculator-service
|
89 |
-
dockerfile: Dockerfile
|
90 |
-
depends_on:
|
91 |
-
- kafka
|
92 |
-
environment:
|
93 |
-
SPRING_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
|
94 |
-
SPRING_DATASOURCE_URL: jdbc:h2:mem:testdb
|
95 |
-
ports:
|
96 |
-
- "8083:8083"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
datasets
|
2 |
+
transformers
|
3 |
+
torch
|
4 |
+
gradio
|