wapeto
wapeto
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Okay no problem, once again thanks for your help and time, you really saved me there
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
labels would be lists of strings
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
This is how I created my original database in python
class Shard(db.Model):
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(500), nullable=False)
labels = db.Column(db.PickleType, nullable=False)
date = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now())
class Shard(db.Model):
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(500), nullable=False)
labels = db.Column(db.PickleType, nullable=False)
date = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now())
But I don't see the option for the label row in the postgre ui on railway
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
okay thx a lot for that, one last question if I may ?
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
in my local terminal I would type : railway run npm start ?
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Well... It also made me create a whole lot of different Dockerfiles and other things
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Will I still be able to run the project locally ?
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Thanks a lot for your help ! You are the proof humans are still smarter than machines (I spent 2 days on this problem and chatGPT cound't find any working solutions)
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
okay
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
normally...
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
I do, this is were the texts and tokens are saved
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
I'm sorry the error for the crash was my fault, it's solved now and the backend logs are empty :
[2023-06-04 22:07:08 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2023-06-04 22:07:08 +0000] [1] [INFO] Listening at: http://0.0.0.0:7940 (1)
[2023-06-04 22:07:08 +0000] [1] [INFO] Using worker: sync
[2023-06-04 22:07:08 +0000] [10] [INFO] Booting worker with pid: 10
['/app', '/opt/venv/bin', '/root/.nix-profile/lib/python38.zip', '/root/.nix-profile/lib/python3.8', '/root/.nix-profile/lib/python3.8/lib-dynload', '/opt/venv/lib/python3.8/site-packages']
[2023-06-04 22:07:08 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2023-06-04 22:07:08 +0000] [1] [INFO] Listening at: http://0.0.0.0:7940 (1)
[2023-06-04 22:07:08 +0000] [1] [INFO] Using worker: sync
[2023-06-04 22:07:08 +0000] [10] [INFO] Booting worker with pid: 10
['/app', '/opt/venv/bin', '/root/.nix-profile/lib/python38.zip', '/root/.nix-profile/lib/python3.8', '/root/.nix-profile/lib/python3.8/lib-dynload', '/opt/venv/lib/python3.8/site-packages']
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Well it's just some kind of memory, you input some text, when you save it labels it, and when you type some keywords in the searchbar, the most relevant texts shoudl show up
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
should i add a ressource ?
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
abnar.up.railway.app/:1 Access to XMLHttpRequest at 'https://abnar-backend.up.railway.app/save' from origin 'https://abnar.up.railway.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
abnar.up.railway.app/:1 Access to XMLHttpRequest at 'https://abnar-backend.up.railway.app/save' from origin 'https://abnar.up.railway.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
My bad
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
Where results is set
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
And the code this comes from is the SearchInput.js :
import React, { useState } from "react";
import axios from "axios";

function SearchInput() {
const [input, setInput] = useState("");
const [results, setResults] = useState([]);

const handleSubmit = async () => {
try {
const response = await axios.post('abnar-backend.up.railway.app/search', { input });
setResults(response.data.results);
console.log("Searched!")
} catch (error) {
console.error(error);
}
};

return (
<div>
<input type="text" value={input} onChange={e => setInput(e.target.value)} />
<button onClick={handleSubmit}>Search</button>
{results.map((result, index) => (
<p key={index}>{result[0]} | Score: {result[1]}</p>

))}
</div>
);
}

export default SearchInput
import React, { useState } from "react";
import axios from "axios";

function SearchInput() {
const [input, setInput] = useState("");
const [results, setResults] = useState([]);

const handleSubmit = async () => {
try {
const response = await axios.post('abnar-backend.up.railway.app/search', { input });
setResults(response.data.results);
console.log("Searched!")
} catch (error) {
console.error(error);
}
};

return (
<div>
<input type="text" value={input} onChange={e => setInput(e.target.value)} />
<button onClick={handleSubmit}>Search</button>
{results.map((result, index) => (
<p key={index}>{result[0]} | Score: {result[1]}</p>

))}
</div>
);
}

export default SearchInput
147 replies
RRailway
Created by wapeto on 6/4/2023 in #✋|help
ModuleNotFoundError with Flask app
My bad I was mistaken about the error, it's just that the search feature returns this error now :
SearchInput.js:22 Uncaught TypeError: Cannot read properties of undefined (reading 'map')
at Je (SearchInput.js:22:22)
at xl (react-dom.production.min.js:167:137)
at Pi (react-dom.production.min.js:197:258)
at xu (react-dom.production.min.js:292:88)
at ws (react-dom.production.min.js:280:389)
at gs (react-dom.production.min.js:280:320)
at ys (react-dom.production.min.js:280:180)
at ls (react-dom.production.min.js:271:88)
at os (react-dom.production.min.js:268:429)
at S (scheduler.production.min.js:13:203)
SearchInput.js:22 Uncaught TypeError: Cannot read properties of undefined (reading 'map')
at Je (SearchInput.js:22:22)
at xl (react-dom.production.min.js:167:137)
at Pi (react-dom.production.min.js:197:258)
at xu (react-dom.production.min.js:292:88)
at ws (react-dom.production.min.js:280:389)
at gs (react-dom.production.min.js:280:320)
at ys (react-dom.production.min.js:280:180)
at ls (react-dom.production.min.js:271:88)
at os (react-dom.production.min.js:268:429)
at S (scheduler.production.min.js:13:203)
147 replies