Compare commits
No commits in common. "2365e0b907888b8c239d019cbfebfc3ecafdfd45" and "7fe8f9a0df41b7e8ae52348f042594c987f2ed1b" have entirely different histories.
2365e0b907
...
7fe8f9a0df
@ -1,6 +1,3 @@
|
|||||||
import java.util.Properties
|
|
||||||
import java.io.FileInputStream
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
@ -8,29 +5,20 @@ plugins {
|
|||||||
alias(libs.plugins.google.services)
|
alias(libs.plugins.google.services)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load properties from local.properties file
|
|
||||||
val localProperties = Properties()
|
|
||||||
val localPropertiesFile = rootProject.file("local.properties")
|
|
||||||
if (localPropertiesFile.exists()) {
|
|
||||||
localProperties.load(FileInputStream(localPropertiesFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.example.ppb_kelompok2"
|
namespace = "com.example.ppb_kelompok2"
|
||||||
compileSdk = 35
|
compileSdk {
|
||||||
|
version = release(36)
|
||||||
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.example.ppb_kelompok2"
|
applicationId = "com.example.ppb_kelompok2"
|
||||||
minSdk = 25
|
minSdk = 25
|
||||||
targetSdk = 35
|
targetSdk = 36
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
// Expose the API key as a BuildConfig field
|
|
||||||
// This reads the HF_API_KEY from your local.properties file
|
|
||||||
buildConfigField("String", "HF_API_KEY", "\"${localProperties.getProperty("HF_API_KEY") ?: ""}\"")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -51,7 +39,6 @@ android {
|
|||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
buildConfig = true // Ensure this is enabled
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +60,6 @@ dependencies {
|
|||||||
implementation(libs.retrofit)
|
implementation(libs.retrofit)
|
||||||
implementation(libs.retrofit.gson)
|
implementation(libs.retrofit.gson)
|
||||||
implementation(libs.okhttp.logging)
|
implementation(libs.okhttp.logging)
|
||||||
implementation(libs.coil.compose)
|
|
||||||
|
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
androidTestImplementation(libs.androidx.junit)
|
androidTestImplementation(libs.androidx.junit)
|
||||||
androidTestImplementation(libs.androidx.espresso.core)
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package com.example.ppb_kelompok2
|
package com.example.ppb_kelompok2
|
||||||
|
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
@ -18,7 +16,7 @@ data class EmotionScore(
|
|||||||
val score: Float
|
val score: Float
|
||||||
)
|
)
|
||||||
|
|
||||||
// --- 2. Zero-Shot Classification Models ---
|
// --- 2. Zero-Shot Classification Models w ---
|
||||||
data class ZeroShotRequest(
|
data class ZeroShotRequest(
|
||||||
val inputs: String,
|
val inputs: String,
|
||||||
val parameters: ZeroShotParameters
|
val parameters: ZeroShotParameters
|
||||||
@ -54,24 +52,13 @@ interface HuggingFaceApiService {
|
|||||||
): ZeroShotResponse
|
): ZeroShotResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- 4. Singleton Instance (with Logging) ---
|
// --- 4. Singleton Instance ---
|
||||||
object RetrofitClient {
|
object RetrofitClient {
|
||||||
private const val BASE_URL = "https://api-inference.huggingface.co/"
|
private const val BASE_URL = "https://api-inference.huggingface.co/"
|
||||||
|
|
||||||
// Membuat Interceptor untuk logging. Level BODY akan menampilkan semua detail request/response.
|
|
||||||
private val loggingInterceptor = HttpLoggingInterceptor().apply {
|
|
||||||
level = HttpLoggingInterceptor.Level.BODY
|
|
||||||
}
|
|
||||||
|
|
||||||
// Menambahkan interceptor ke OkHttpClient
|
|
||||||
private val httpClient = OkHttpClient.Builder()
|
|
||||||
.addInterceptor(loggingInterceptor)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
val apiService: HuggingFaceApiService by lazy {
|
val apiService: HuggingFaceApiService by lazy {
|
||||||
Retrofit.Builder()
|
Retrofit.Builder()
|
||||||
.baseUrl(BASE_URL)
|
.baseUrl(BASE_URL)
|
||||||
.client(httpClient) // Menggunakan client custom yang sudah ada logger-nya
|
|
||||||
.addConverterFactory(GsonConverterFactory.create())
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
.build()
|
.build()
|
||||||
.create(HuggingFaceApiService::class.java)
|
.create(HuggingFaceApiService::class.java)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,6 @@ firebaseBom = "33.1.2"
|
|||||||
playServicesAuth = "20.7.0"
|
playServicesAuth = "20.7.0"
|
||||||
retrofit = "2.9.0"
|
retrofit = "2.9.0"
|
||||||
okhttp = "4.12.0"
|
okhttp = "4.12.0"
|
||||||
coil = "2.5.0"
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
@ -37,7 +36,6 @@ play-services-auth = { group = "com.google.android.gms", name = "play-services-a
|
|||||||
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
|
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
|
||||||
retrofit-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
|
retrofit-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
|
||||||
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
|
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
|
||||||
coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" }
|
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user