Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
@@ -4,9 +4,13 @@ import tensorflow as tf
|
|
4 |
from tensorflow.keras import layers
|
5 |
import asyncio
|
6 |
from fastapi import FastAPI, Request
|
7 |
-
from fastapi.responses import StreamingResponse
|
8 |
import sentencepiece as spm
|
9 |
import re
|
|
|
|
|
|
|
|
|
10 |
app = FastAPI()
|
11 |
|
12 |
|
@@ -140,16 +144,6 @@ _ = model(dummy_input) # 모델이 빌드됨
|
|
140 |
model.load_weights("InteractGPT.weights.h5")
|
141 |
print("모델 가중치 로드 완료!")
|
142 |
|
143 |
-
import re
|
144 |
-
import math
|
145 |
-
import numpy as np
|
146 |
-
import requests
|
147 |
-
import tensorflow as tf
|
148 |
-
from sklearn.feature_extraction.text import TfidfVectorizer
|
149 |
-
from sklearn.metrics.pairwise import cosine_similarity
|
150 |
-
from fastapi import Request
|
151 |
-
from fastapi.responses import PlainTextResponse
|
152 |
-
|
153 |
|
154 |
def is_greedy_response_acceptable(text):
|
155 |
text = text.strip()
|
|
|
4 |
from tensorflow.keras import layers
|
5 |
import asyncio
|
6 |
from fastapi import FastAPI, Request
|
7 |
+
from fastapi.responses import StreamingResponse, PlainTextResponse
|
8 |
import sentencepiece as spm
|
9 |
import re
|
10 |
+
import math
|
11 |
+
from sklearn.feature_extraction.text import TfidfVectorizer
|
12 |
+
from sklearn.metrics.pairwise import cosine_similarity
|
13 |
+
|
14 |
app = FastAPI()
|
15 |
|
16 |
|
|
|
144 |
model.load_weights("InteractGPT.weights.h5")
|
145 |
print("모델 가중치 로드 완료!")
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
def is_greedy_response_acceptable(text):
|
149 |
text = text.strip()
|