Spaces:
Runtime error
Runtime error
acecalisto3
commited on
Commit
•
ba67100
1
Parent(s):
250d751
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,7 @@ from typing import Dict, Any
|
|
4 |
from functools import partial
|
5 |
|
6 |
from flask import Flask, request, jsonify
|
7 |
-
from
|
8 |
-
from langchain.llms import OpenAI
|
9 |
-
from langchain.chains import ConversationChain
|
10 |
-
from langchain.memory import ConversationBufferMemory
|
11 |
-
from langchain.vectorstores import Chroma
|
12 |
-
from langchain.embeddings import OpenAIEmbeddings
|
13 |
-
from langchain.document_loaders import TextLoader
|
14 |
|
15 |
logging.basicConfig(level=logging.INFO)
|
16 |
|
@@ -51,10 +45,7 @@ class UIUXWizard:
|
|
51 |
def __init__(self, model_manager: ModelManager, vector_store=None):
|
52 |
self.model_manager = model_manager
|
53 |
self.vector_store = vector_store
|
54 |
-
self.conversation_chain =
|
55 |
-
llm=OpenAI(temperature=0.7),
|
56 |
-
memory=ConversationBufferMemory(),
|
57 |
-
)
|
58 |
|
59 |
async def start(self):
|
60 |
await self.model_manager.start()
|
@@ -70,7 +61,8 @@ class UIUXWizard:
|
|
70 |
return "\n".join(results)
|
71 |
|
72 |
def get_conversation_response(self, query):
|
73 |
-
|
|
|
74 |
|
75 |
# Define VersionControl class
|
76 |
class VersionControl:
|
@@ -216,7 +208,7 @@ if __name__ == "__main__":
|
|
216 |
|
217 |
# Start the cluster and task processing loop
|
218 |
asyncio.run(cluster.start())
|
219 |
-
asyncio.
|
220 |
|
221 |
# Run Flask app
|
222 |
-
app.run(debug=True)
|
|
|
4 |
from functools import partial
|
5 |
|
6 |
from flask import Flask, request, jsonify
|
7 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
logging.basicConfig(level=logging.INFO)
|
10 |
|
|
|
45 |
def __init__(self, model_manager: ModelManager, vector_store=None):
|
46 |
self.model_manager = model_manager
|
47 |
self.vector_store = vector_store
|
48 |
+
self.conversation_chain = pipeline("text-generation", model="gpt2")
|
|
|
|
|
|
|
49 |
|
50 |
async def start(self):
|
51 |
await self.model_manager.start()
|
|
|
61 |
return "\n".join(results)
|
62 |
|
63 |
def get_conversation_response(self, query):
|
64 |
+
response = self.conversation_chain(query, max_length=5000, num_return_sequences=1)[0]['generated_text']
|
65 |
+
return response
|
66 |
|
67 |
# Define VersionControl class
|
68 |
class VersionControl:
|
|
|
208 |
|
209 |
# Start the cluster and task processing loop
|
210 |
asyncio.run(cluster.start())
|
211 |
+
asyncio.create_task(cluster.process_tasks())
|
212 |
|
213 |
# Run Flask app
|
214 |
+
app.run(debug=True)
|