-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. 입력된 식단 리스트에 출력 기능 3.
- Loading branch information
Showing
24 changed files
with
856 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import requests | ||
|
||
url = "http://192.168.45.102:2375/process_image" | ||
# url = 'tcp://localhost:2375/process_image' | ||
|
||
files = { | ||
"file": ( | ||
"velog.jpg", | ||
open("static/asset/food_images/가래떡.jpg", "rb"), | ||
"image/jpeg", | ||
) | ||
} | ||
data = {"title": "Your Title", "content": "Your Content"} | ||
|
||
# API 호출 | ||
response = requests.post(url, files=files, data=data) | ||
|
||
# 결과 수신 및 처리 | ||
result = response.json() | ||
print(result) | ||
# processed_image_data = result['processed_image'] | ||
# processed_image_bytes = bytes.fromhex(processed_image_data) | ||
|
||
# # 처리된 이미지를 파일로 저장 | ||
# with open('processed_image.jpg', 'wb') as file: | ||
# file.write(processed_image_bytes) | ||
|
||
# # 결과에서 단어 리스트 추출 | ||
# food_classes = result.get('food_classes', []) | ||
|
||
# # 여러 개의 단어를 가진 리스트 출력 | ||
# print("food_classes:", food_classes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import UserDiet, DetailOfDiet | ||
|
||
admin.site.register(UserDiet) | ||
admin.site.register(DetailOfDiet) |
37 changes: 37 additions & 0 deletions
37
diet/migrations/0005_remove_detailofdiet_image_x_end_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 5.0.1 on 2024-02-20 12:08 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("diet", "0004_remove_food_created_at_remove_food_deleted_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="detailofdiet", | ||
name="image_x_end", | ||
), | ||
migrations.RemoveField( | ||
model_name="detailofdiet", | ||
name="image_x_start", | ||
), | ||
migrations.RemoveField( | ||
model_name="detailofdiet", | ||
name="image_y_end", | ||
), | ||
migrations.RemoveField( | ||
model_name="detailofdiet", | ||
name="image_y_start", | ||
), | ||
migrations.AddField( | ||
model_name="detailofdiet", | ||
name="image_path", | ||
field=models.CharField( | ||
db_comment="음식 이미지 경로", default=1, max_length=200 | ||
), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.1 on 2024-02-21 02:19 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("diet", "0005_remove_detailofdiet_image_x_end_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="userdiet", | ||
old_name="take_at", | ||
new_name="take_date", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.0.1 on 2024-02-21 02:22 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("diet", "0006_rename_take_at_userdiet_take_date"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="userdiet", | ||
name="take_at", | ||
field=models.DateTimeField( | ||
db_comment="식단을 섭취한 날짜 및 시간", | ||
default=datetime.datetime(2024, 2, 21, 11, 22, 18, 283415), | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.0.1 on 2024-02-21 06:31 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("diet", "0007_userdiet_take_at"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="userdiet", | ||
name="take_at", | ||
field=models.DateTimeField( | ||
db_comment="식단을 섭취한 날짜 및 시간", | ||
default=datetime.datetime(2024, 2, 21, 15, 31, 7, 184460), | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.